nextjs-cms 0.5.68 → 0.5.69

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 (42) hide show
  1. package/dist/api/index.d.ts +6 -34
  2. package/dist/api/index.d.ts.map +1 -1
  3. package/dist/api/index.js +2 -2
  4. package/dist/api/lib/serverActions.d.ts +6 -0
  5. package/dist/api/lib/serverActions.d.ts.map +1 -1
  6. package/dist/api/lib/serverActions.js +64 -9
  7. package/dist/api/root.d.ts +34 -89
  8. package/dist/api/root.d.ts.map +1 -1
  9. package/dist/api/root.js +15 -18
  10. package/dist/api/routers/admins.d.ts.map +1 -1
  11. package/dist/api/routers/admins.js +53 -3
  12. package/dist/api/routers/gallery.d.ts.map +1 -1
  13. package/dist/api/routers/gallery.js +1 -0
  14. package/dist/api/trpc/client.d.ts +4 -0
  15. package/dist/api/trpc/client.d.ts.map +1 -0
  16. package/dist/api/trpc/client.js +3 -0
  17. package/dist/api/trpc.d.ts +12 -0
  18. package/dist/api/trpc.d.ts.map +1 -1
  19. package/dist/api/trpc.js +24 -0
  20. package/dist/core/config/loader.d.ts +1 -1
  21. package/dist/core/config/loader.d.ts.map +1 -1
  22. package/dist/core/config/loader.js +1 -1
  23. package/dist/core/factories/SectionFactory.d.ts +1 -1
  24. package/dist/core/factories/SectionFactory.d.ts.map +1 -1
  25. package/dist/core/factories/SectionFactory.js +1 -1
  26. package/dist/core/factories/section-factory-with-esbuild.d.ts +0 -4
  27. package/dist/core/factories/section-factory-with-esbuild.d.ts.map +1 -1
  28. package/dist/core/factories/section-factory-with-esbuild.js +1 -5
  29. package/dist/core/factories/section-factory-with-jiti.d.ts +0 -4
  30. package/dist/core/factories/section-factory-with-jiti.d.ts.map +1 -1
  31. package/dist/core/factories/section-factory-with-jiti.js +1 -5
  32. package/dist/core/submit/ItemEditSubmit.d.ts.map +1 -1
  33. package/dist/plugins/index.d.ts +2 -1
  34. package/dist/plugins/index.d.ts.map +1 -1
  35. package/dist/plugins/index.js +1 -0
  36. package/dist/plugins/loader.d.ts +37 -6
  37. package/dist/plugins/loader.d.ts.map +1 -1
  38. package/dist/plugins/loader.js +41 -8
  39. package/package.json +7 -3
  40. package/dist/api/routers/googleAnalytics.d.ts +0 -29
  41. package/dist/api/routers/googleAnalytics.d.ts.map +0 -1
  42. package/dist/api/routers/googleAnalytics.js +0 -7
@@ -1,7 +1,7 @@
1
1
  import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
2
2
  import type { AppRouter } from './root.js';
3
3
  import { appRouter, createCallerWithPlugins, getAppRouter } from './root.js';
4
- import { createTRPCContext, privateProcedure, publicProcedure, router } from './trpc.js';
4
+ import { createTRPCContext, privateProcedure, publicProcedure, router, pluginProcedure } from './trpc.js';
5
5
  /**
6
6
  * Create a server-side caller for the tRPC API
7
7
  * @example
@@ -781,42 +781,14 @@ declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
781
781
  };
782
782
  transformer: true;
783
783
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
784
- list: import("@trpc/server").TRPCQueryProcedure<{
785
- input: void;
786
- output: {
787
- id: string;
788
- name: string;
789
- version: string | undefined;
790
- package: string;
791
- }[];
792
- meta: object;
793
- }>;
794
- routes: import("@trpc/server").TRPCQueryProcedure<{
795
- input: void;
796
- output: {
797
- pluginId: string;
798
- pluginName?: string;
784
+ checkRoute: import("@trpc/server").TRPCQueryProcedure<{
785
+ input: {
799
786
  path: string;
800
- title: string;
801
- icon?: string;
802
- component: string;
803
- }[];
787
+ };
788
+ output: import("../plugins/loader.js").LoadedPluginRoute | null;
804
789
  meta: object;
805
790
  }>;
806
791
  }>>;
807
- getHello1: import("@trpc/server").TRPCQueryProcedure<{
808
- input: void;
809
- output: {
810
- headers: Headers;
811
- db: import("drizzle-orm/mysql2").MySql2Database<typeof import("../db/schema.js")> & {
812
- $client: import("mysql2/promise").Pool;
813
- };
814
- session: {
815
- user: import("../index.js").User;
816
- };
817
- };
818
- meta: object;
819
- }>;
820
792
  }>>;
821
793
  /**
822
794
  * Inference helpers for input types
@@ -833,7 +805,7 @@ type RouterInputs = inferRouterInputs<AppRouter>;
833
805
  **/
834
806
  type RouterOutputs = inferRouterOutputs<AppRouter>;
835
807
  export { createTRPCContext, appRouter, createCaller, createCallerWithPlugins, getAppRouter };
836
- export { router, publicProcedure, privateProcedure };
808
+ export { router, publicProcedure, privateProcedure, pluginProcedure };
837
809
  export type { AppRouter, RouterInputs, RouterOutputs };
838
810
  export { axiosPrivate } from './axios/axiosInstance.js';
839
811
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC5E,OAAO,EAAuB,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAE7G;;;;;;GAMG;AACH,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,uBAAuB,EAAE,YAAY,EAAE,CAAA;AAC5F,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAA;AACrE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA"}
package/dist/api/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { appRouter, createCallerWithPlugins, getAppRouter } from './root.js';
2
- import { createCallerFactory, createTRPCContext, privateProcedure, publicProcedure, router } from './trpc.js';
2
+ import { createCallerFactory, createTRPCContext, privateProcedure, publicProcedure, router, pluginProcedure, } from './trpc.js';
3
3
  /**
4
4
  * Create a server-side caller for the tRPC API
5
5
  * @example
@@ -9,5 +9,5 @@ import { createCallerFactory, createTRPCContext, privateProcedure, publicProcedu
9
9
  */
10
10
  const createCaller = createCallerFactory(appRouter);
11
11
  export { createTRPCContext, appRouter, createCaller, createCallerWithPlugins, getAppRouter };
12
- export { router, publicProcedure, privateProcedure };
12
+ export { router, publicProcedure, privateProcedure, pluginProcedure };
13
13
  export { axiosPrivate } from './axios/axiosInstance.js';
@@ -1,4 +1,9 @@
1
1
  import type { Session } from '../../auth/index.js';
2
+ export declare const isAccessAllowed: ({ sectionName, role, userId, }: {
3
+ sectionName: string;
4
+ role?: "C" | "U" | "D";
5
+ userId: string;
6
+ }) => Promise<boolean>;
2
7
  export declare const getDocument: (session: Session, input: {
3
8
  name: string;
4
9
  sectionName: string;
@@ -22,6 +27,7 @@ export declare const getVideo: (input: {
22
27
  sectionName: string;
23
28
  fieldName: string;
24
29
  }) => Promise<never>;
30
+ export declare const getAdminPrivileges: (adminId: string) => Promise<Set<string>>;
25
31
  export declare const getAllPrivileges: () => Promise<{
26
32
  title: string;
27
33
  order: number;
@@ -1 +1 @@
1
- {"version":3,"file":"serverActions.d.ts","sourceRoot":"","sources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6EnF,MAAM,GAAG,MAAM;sBACL,MAAM;oBACR,MAAM,GAAG,IAAI;mBACd,MAAM;mBACN,MAAM;oBACL,MAAM;;;;EAKjC,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;EA+DhD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACnB,MAAM,MAAM,EACZ,UAAU;IACN,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;CACf,KACF,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAcpC,CAAA"}
@@ -15,6 +15,24 @@ import { fileTypeFromBuffer } from 'file-type';
15
15
  import { getCMSConfig } from '../../core/config/index.js';
16
16
  import { getPluginRoutes } from '../../plugins/loader.js';
17
17
  import through2 from 'through2';
18
+ export const isAccessAllowed = async ({ sectionName, role, userId, }) => {
19
+ /**
20
+ * Check admin privileges
21
+ */
22
+ const _res = await db
23
+ .select()
24
+ .from(AdminPrivilegesTable)
25
+ .where(and(eq(AdminPrivilegesTable.adminId, userId), eq(AdminPrivilegesTable.sectionName, sectionName)))
26
+ .limit(1);
27
+ const allowed = _res[0];
28
+ if (!allowed)
29
+ return false;
30
+ if (role) {
31
+ if (!allowed.operations.includes(role))
32
+ return false;
33
+ }
34
+ return true;
35
+ };
18
36
  export const getDocument = async (session, input) => {
19
37
  const { name, sectionName, fieldName } = input;
20
38
  // Sanitize the inputs
@@ -199,8 +217,15 @@ export async function streamPhoto(input) {
199
217
  export const getVideo = async (input) => {
200
218
  throw new Error('Please use the /api/video route');
201
219
  };
220
+ export const getAdminPrivileges = async (adminId) => {
221
+ const rows = await db
222
+ .select({ sectionName: AdminPrivilegesTable.sectionName })
223
+ .from(AdminPrivilegesTable)
224
+ .where(eq(AdminPrivilegesTable.adminId, adminId));
225
+ return new Set(rows.map((row) => row.sectionName));
226
+ };
202
227
  export const getAllPrivileges = async () => {
203
- const sections = await SectionFactory.getSections();
228
+ const [sections, pluginRoutes] = await Promise.all([SectionFactory.getSections(), getPluginRoutes()]);
204
229
  // First, let's assign the static privileges
205
230
  const privilegesList = [];
206
231
  // Now, let's add the rest of the privileges to the list
@@ -212,7 +237,23 @@ export const getAllPrivileges = async () => {
212
237
  sectionType: section.type,
213
238
  });
214
239
  });
215
- privilegesList.push({ title: 'Admins', order: 0, sectionName: 'admins', sectionType: 'static' }, { title: 'Emails', order: 1, sectionName: 'emails', sectionType: 'static' }, { title: 'Log', order: 2, sectionName: 'log', sectionType: 'static' });
240
+ const pluginPrivileges = new Map();
241
+ pluginRoutes.forEach((route) => {
242
+ if (pluginPrivileges.has(route.pluginName))
243
+ return;
244
+ pluginPrivileges.set(route.pluginName, {
245
+ title: route.pluginTitle,
246
+ });
247
+ });
248
+ Array.from(pluginPrivileges.entries()).forEach(([pluginName, meta], index) => {
249
+ privilegesList.push({
250
+ title: meta.title,
251
+ order: sections.length + index,
252
+ sectionName: pluginName,
253
+ sectionType: 'plugin',
254
+ });
255
+ });
256
+ privilegesList.push({ title: 'Admins', order: 0, sectionName: 'admins', sectionType: 'static' }, { title: 'Log', order: 2, sectionName: 'log', sectionType: 'static' });
216
257
  return privilegesList;
217
258
  };
218
259
  export const getAdminsList = async () => {
@@ -310,13 +351,14 @@ export const deleteSectionItem = async (session, sectionName, sectionItemId, rec
310
351
  name: sectionName,
311
352
  admin: {
312
353
  id: session.user.id,
354
+ requiredRole: 'D',
313
355
  },
314
356
  });
315
357
  const section = _s?.build();
316
358
  if (!section) {
317
359
  return {
318
360
  error: {
319
- message: 'Section not found or you do not have access to it',
361
+ message: 'Section not found or you do not have access to this operation',
320
362
  },
321
363
  };
322
364
  }
@@ -624,7 +666,7 @@ export const getCategorySectionChildren = async ({ session, id, sectionName, lev
624
666
  if (!section) {
625
667
  return {
626
668
  error: {
627
- message: 'Section not found or you do not have access to it',
669
+ message: 'Section not found or you do not have access to this operation',
628
670
  },
629
671
  };
630
672
  }
@@ -672,7 +714,7 @@ export const getCategorySection = async (session, sectionName) => {
672
714
  if (!section) {
673
715
  throw new TRPCError({
674
716
  code: 'NOT_FOUND',
675
- message: 'Section not found or you do not have access to it',
717
+ message: 'Section not found or you do not have access to this operation',
676
718
  });
677
719
  }
678
720
  const tableName = section.db.table;
@@ -730,7 +772,7 @@ export const getBrowsePage = async (session, sectionName, page = 1, q) => {
730
772
  if (!section) {
731
773
  return {
732
774
  error: {
733
- message: 'Section not found or you do not have access to it',
775
+ message: 'Section not found or you do not have access to this operation',
734
776
  },
735
777
  };
736
778
  }
@@ -797,6 +839,8 @@ export const getSidebar = async (session) => {
797
839
  admin: { id: session.user.id },
798
840
  });
799
841
  const pluginRoutes = await getPluginRoutes();
842
+ const privilegeSet = await getAdminPrivileges(session.user.id);
843
+ const allowedPluginRoutes = pluginRoutes.filter(({ pluginName }) => privilegeSet.has(pluginName));
800
844
  // Let's loop through the sections and add path, icon and title to each section item
801
845
  const simpleSectionItems = simple.map((section) => {
802
846
  return {
@@ -819,14 +863,25 @@ export const getSidebar = async (session) => {
819
863
  icon: section.icon,
820
864
  };
821
865
  });
822
- const pluginSections = pluginRoutes.map((route) => ({
866
+ const pluginSections = allowedPluginRoutes.map((route) => ({
823
867
  title: route.title,
824
868
  path: route.path,
825
- icon: route.icon ?? 'home',
869
+ icon: route.icon ?? '',
826
870
  }));
827
871
  const fixedSections = [
872
+ /**
873
+ * Add the default dashboard section
874
+ */
875
+ {
876
+ title: 'Dashboard',
877
+ path: '/dashboard',
878
+ icon: 'home',
879
+ },
880
+ /**
881
+ * Add the plugin sections
882
+ */
828
883
  ...pluginSections,
829
- ...fixed.map((section) => ({ title: section, path: `/${section}`, icon: 'home' })),
884
+ ...fixed.map((section) => ({ title: section, path: `/${section}`, icon: '' })),
830
885
  ];
831
886
  return {
832
887
  fixed_sections: fixedSections,
@@ -1,4 +1,5 @@
1
1
  import type { TRPCContext } from './trpc.js';
2
+ import { z } from 'zod';
2
3
  export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
3
4
  ctx: {
4
5
  headers: Headers;
@@ -10,7 +11,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
10
11
  meta: object;
11
12
  errorShape: {
12
13
  data: {
13
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
14
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
14
15
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
15
16
  httpStatus: number;
16
17
  path?: string;
@@ -32,7 +33,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
32
33
  meta: object;
33
34
  errorShape: {
34
35
  data: {
35
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
36
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
36
37
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
37
38
  httpStatus: number;
38
39
  path?: string;
@@ -84,7 +85,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
84
85
  meta: object;
85
86
  errorShape: {
86
87
  data: {
87
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
88
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
88
89
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
89
90
  httpStatus: number;
90
91
  path?: string;
@@ -186,7 +187,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
186
187
  meta: object;
187
188
  errorShape: {
188
189
  data: {
189
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
190
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
190
191
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
191
192
  httpStatus: number;
192
193
  path?: string;
@@ -368,7 +369,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
368
369
  meta: object;
369
370
  errorShape: {
370
371
  data: {
371
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
372
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
372
373
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
373
374
  httpStatus: number;
374
375
  path?: string;
@@ -441,7 +442,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
441
442
  meta: object;
442
443
  errorShape: {
443
444
  data: {
444
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
445
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
445
446
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
446
447
  httpStatus: number;
447
448
  path?: string;
@@ -541,7 +542,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
541
542
  meta: object;
542
543
  errorShape: {
543
544
  data: {
544
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
545
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
545
546
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
546
547
  httpStatus: number;
547
548
  path?: string;
@@ -585,7 +586,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
585
586
  meta: object;
586
587
  errorShape: {
587
588
  data: {
588
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
589
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
589
590
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
590
591
  httpStatus: number;
591
592
  path?: string;
@@ -617,7 +618,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
617
618
  meta: object;
618
619
  errorShape: {
619
620
  data: {
620
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
621
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
621
622
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
622
623
  httpStatus: number;
623
624
  path?: string;
@@ -666,7 +667,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
666
667
  meta: object;
667
668
  errorShape: {
668
669
  data: {
669
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
670
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
670
671
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
671
672
  httpStatus: number;
672
673
  path?: string;
@@ -719,7 +720,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
719
720
  meta: object;
720
721
  errorShape: {
721
722
  data: {
722
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
723
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
723
724
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
724
725
  httpStatus: number;
725
726
  path?: string;
@@ -760,7 +761,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
760
761
  meta: object;
761
762
  errorShape: {
762
763
  data: {
763
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
764
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
764
765
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
765
766
  httpStatus: number;
766
767
  path?: string;
@@ -771,42 +772,14 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
771
772
  };
772
773
  transformer: true;
773
774
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
774
- list: import("@trpc/server").TRPCQueryProcedure<{
775
- input: void;
776
- output: {
777
- id: string;
778
- name: string;
779
- version: string | undefined;
780
- package: string;
781
- }[];
782
- meta: object;
783
- }>;
784
- routes: import("@trpc/server").TRPCQueryProcedure<{
785
- input: void;
786
- output: {
787
- pluginId: string;
788
- pluginName?: string;
775
+ checkRoute: import("@trpc/server").TRPCQueryProcedure<{
776
+ input: {
789
777
  path: string;
790
- title: string;
791
- icon?: string;
792
- component: string;
793
- }[];
778
+ };
779
+ output: import("../plugins/loader.js").LoadedPluginRoute | null;
794
780
  meta: object;
795
781
  }>;
796
782
  }>>;
797
- getHello1: import("@trpc/server").TRPCQueryProcedure<{
798
- input: void;
799
- output: {
800
- headers: Headers;
801
- db: import("drizzle-orm/mysql2").MySql2Database<typeof import("../db/schema.js")> & {
802
- $client: import("mysql2/promise").Pool;
803
- };
804
- session: {
805
- user: import("../index.js").User;
806
- };
807
- };
808
- meta: object;
809
- }>;
810
783
  }>>;
811
784
  export declare function getAppRouter(): Promise<import("@trpc/server").TRPCBuiltRouter<{
812
785
  ctx: {
@@ -819,7 +792,7 @@ export declare function getAppRouter(): Promise<import("@trpc/server").TRPCBuilt
819
792
  meta: object;
820
793
  errorShape: {
821
794
  data: {
822
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
795
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
823
796
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
824
797
  httpStatus: number;
825
798
  path?: string;
@@ -843,7 +816,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
843
816
  meta: object;
844
817
  errorShape: {
845
818
  data: {
846
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
819
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
847
820
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
848
821
  httpStatus: number;
849
822
  path?: string;
@@ -865,7 +838,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
865
838
  meta: object;
866
839
  errorShape: {
867
840
  data: {
868
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
841
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
869
842
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
870
843
  httpStatus: number;
871
844
  path?: string;
@@ -917,7 +890,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
917
890
  meta: object;
918
891
  errorShape: {
919
892
  data: {
920
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
893
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
921
894
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
922
895
  httpStatus: number;
923
896
  path?: string;
@@ -1019,7 +992,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1019
992
  meta: object;
1020
993
  errorShape: {
1021
994
  data: {
1022
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
995
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1023
996
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1024
997
  httpStatus: number;
1025
998
  path?: string;
@@ -1201,7 +1174,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1201
1174
  meta: object;
1202
1175
  errorShape: {
1203
1176
  data: {
1204
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
1177
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1205
1178
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1206
1179
  httpStatus: number;
1207
1180
  path?: string;
@@ -1274,7 +1247,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1274
1247
  meta: object;
1275
1248
  errorShape: {
1276
1249
  data: {
1277
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
1250
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1278
1251
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1279
1252
  httpStatus: number;
1280
1253
  path?: string;
@@ -1374,7 +1347,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1374
1347
  meta: object;
1375
1348
  errorShape: {
1376
1349
  data: {
1377
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
1350
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1378
1351
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1379
1352
  httpStatus: number;
1380
1353
  path?: string;
@@ -1418,7 +1391,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1418
1391
  meta: object;
1419
1392
  errorShape: {
1420
1393
  data: {
1421
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
1394
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1422
1395
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1423
1396
  httpStatus: number;
1424
1397
  path?: string;
@@ -1450,7 +1423,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1450
1423
  meta: object;
1451
1424
  errorShape: {
1452
1425
  data: {
1453
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
1426
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1454
1427
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1455
1428
  httpStatus: number;
1456
1429
  path?: string;
@@ -1499,7 +1472,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1499
1472
  meta: object;
1500
1473
  errorShape: {
1501
1474
  data: {
1502
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
1475
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1503
1476
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1504
1477
  httpStatus: number;
1505
1478
  path?: string;
@@ -1552,7 +1525,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1552
1525
  meta: object;
1553
1526
  errorShape: {
1554
1527
  data: {
1555
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
1528
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1556
1529
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1557
1530
  httpStatus: number;
1558
1531
  path?: string;
@@ -1593,7 +1566,7 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1593
1566
  meta: object;
1594
1567
  errorShape: {
1595
1568
  data: {
1596
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
1569
+ zodError: z.core.$ZodFlattenedError<unknown, string> | null;
1597
1570
  code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
1598
1571
  httpStatus: number;
1599
1572
  path?: string;
@@ -1604,41 +1577,13 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
1604
1577
  };
1605
1578
  transformer: true;
1606
1579
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1607
- list: import("@trpc/server").TRPCQueryProcedure<{
1608
- input: void;
1609
- output: {
1610
- id: string;
1611
- name: string;
1612
- version: string | undefined;
1613
- package: string;
1614
- }[];
1615
- meta: object;
1616
- }>;
1617
- routes: import("@trpc/server").TRPCQueryProcedure<{
1618
- input: void;
1619
- output: {
1620
- pluginId: string;
1621
- pluginName?: string;
1580
+ checkRoute: import("@trpc/server").TRPCQueryProcedure<{
1581
+ input: {
1622
1582
  path: string;
1623
- title: string;
1624
- icon?: string;
1625
- component: string;
1626
- }[];
1583
+ };
1584
+ output: import("../plugins/loader.js").LoadedPluginRoute | null;
1627
1585
  meta: object;
1628
1586
  }>;
1629
1587
  }>>;
1630
- getHello1: import("@trpc/server").TRPCQueryProcedure<{
1631
- input: void;
1632
- output: {
1633
- headers: Headers;
1634
- db: import("drizzle-orm/mysql2").MySql2Database<typeof import("../db/schema.js")> & {
1635
- $client: import("mysql2/promise").Pool;
1636
- };
1637
- session: {
1638
- user: import("../index.js").User;
1639
- };
1640
- };
1641
- meta: object;
1642
- }>;
1643
1588
  }>>;
1644
1589
  //# sourceMappingURL=root.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/api/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AA4G5C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAA"}
package/dist/api/root.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createCallerFactory, privateProcedure, publicProcedure, router } from './trpc.js';
1
+ import { createCallerFactory, privateProcedure, router } from './trpc.js';
2
2
  import { adminsRouter } from './routers/admins.js';
3
3
  import { hasItemsSectionRouter } from './routers/hasItemsSection.js';
4
4
  import { filesRouter } from './routers/files.js';
@@ -11,15 +11,8 @@ import { cmsSettings } from './routers/cmsSettings.js';
11
11
  import { galleryRouter } from './routers/gallery.js';
12
12
  import { getConfigImportVersion } from '../core/config/index.js';
13
13
  import { getPluginRoutes, loadPlugins } from '../plugins/loader.js';
14
- async function getActivePlugins() {
15
- const loadedPlugins = await loadPlugins();
16
- return loadedPlugins.map((item) => ({
17
- id: item.config.package,
18
- name: item.plugin.name ?? item.config.package,
19
- version: item.plugin.version,
20
- package: item.moduleName,
21
- }));
22
- }
14
+ import { z } from 'zod';
15
+ import { getAdminPrivileges } from './lib/serverActions.js';
23
16
  async function getPluginRouters() {
24
17
  const loadedPlugins = await loadPlugins();
25
18
  return loadedPlugins.reduce((acc, current) => {
@@ -30,12 +23,19 @@ async function getPluginRouters() {
30
23
  }, {});
31
24
  }
32
25
  const pluginsRouter = router({
33
- list: publicProcedure.query(async () => {
34
- return getActivePlugins();
35
- }),
36
- routes: publicProcedure.query(async () => {
26
+ checkRoute: privateProcedure
27
+ .input(z.object({
28
+ path: z.string(),
29
+ }))
30
+ .query(async ({ ctx, input }) => {
37
31
  const routes = await getPluginRoutes();
38
- return routes.map(({ prefetch, ...rest }) => rest);
32
+ const privilegeSet = await getAdminPrivileges(ctx.session.user.id);
33
+ const filteredRoutes = routes.filter(({ pluginName }) => privilegeSet.has(pluginName));
34
+ const plugin = filteredRoutes.find(({ path }) => path === input.path);
35
+ if (!plugin) {
36
+ return null;
37
+ }
38
+ return plugin;
39
39
  }),
40
40
  });
41
41
  const coreRouters = {
@@ -50,9 +50,6 @@ const coreRouters = {
50
50
  accountSettings: accountSettings,
51
51
  cmsSettings: cmsSettings,
52
52
  plugins: pluginsRouter,
53
- getHello1: privateProcedure.query(async ({ ctx }) => {
54
- return ctx;
55
- }),
56
53
  };
57
54
  // Lazy router creation - cache the result
58
55
  let _appRouter = null;
@@ -1 +1 @@
1
- {"version":3,"file":"admins.d.ts","sourceRoot":"","sources":["../../../src/api/routers/admins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAaxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+OvB,CAAA"}
1
+ {"version":3,"file":"admins.d.ts","sourceRoot":"","sources":["../../../src/api/routers/admins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAaxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiSvB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { router, privateProcedure } from '../trpc.js';
2
2
  import * as z from 'zod';
3
- import { getAdminsList, getAllPrivileges } from '../lib/serverActions.js';
3
+ import { getAdminsList, getAllPrivileges, isAccessAllowed } from '../lib/serverActions.js';
4
4
  import { db } from '../../db/client.js';
5
5
  import { AdminPrivilegesTable, AdminsTable } from '../../db/schema.js';
6
6
  import { eq } from 'drizzle-orm';
@@ -12,7 +12,17 @@ import path from 'path';
12
12
  import fs from 'fs';
13
13
  import { getCMSConfig } from '../../core/config/index.js';
14
14
  export const adminsRouter = router({
15
- list: privateProcedure.query(async () => {
15
+ list: privateProcedure.query(async ({ ctx }) => {
16
+ const accessAllowed = await isAccessAllowed({
17
+ sectionName: 'admins',
18
+ userId: ctx.session.user.id,
19
+ });
20
+ if (!accessAllowed) {
21
+ throw new TRPCError({
22
+ code: 'NOT_FOUND',
23
+ message: 'Section not found or you do not have access to this operation',
24
+ });
25
+ }
16
26
  const data = await Promise.all([getAdminsList(), getAllPrivileges()]);
17
27
  const adminList = data[0];
18
28
  const privileges = data[1];
@@ -22,6 +32,16 @@ export const adminsRouter = router({
22
32
  };
23
33
  }),
24
34
  get: privateProcedure.input(z.string()).query(async (opts) => {
35
+ const accessAllowed = await isAccessAllowed({
36
+ sectionName: 'admins',
37
+ userId: opts.ctx.session.user.id,
38
+ });
39
+ if (!accessAllowed) {
40
+ throw new TRPCError({
41
+ code: 'NOT_FOUND',
42
+ message: 'Section not found or you do not have access to this operation',
43
+ });
44
+ }
25
45
  const data = await Promise.all([
26
46
  db
27
47
  .select({
@@ -67,6 +87,16 @@ export const adminsRouter = router({
67
87
  })),
68
88
  }))
69
89
  .mutation(async ({ ctx, input }) => {
90
+ const accessAllowed = await isAccessAllowed({
91
+ sectionName: 'admins',
92
+ userId: ctx.session.user.id,
93
+ });
94
+ if (!accessAllowed) {
95
+ throw new TRPCError({
96
+ code: 'NOT_FOUND',
97
+ message: 'Section not found or you do not have access to this operation',
98
+ });
99
+ }
70
100
  /**
71
101
  * First, let's check if the username already exists
72
102
  */
@@ -130,6 +160,16 @@ export const adminsRouter = router({
130
160
  })),
131
161
  }))
132
162
  .mutation(async ({ ctx, input }) => {
163
+ const accessAllowed = await isAccessAllowed({
164
+ sectionName: 'admins',
165
+ userId: ctx.session.user.id,
166
+ });
167
+ if (!accessAllowed) {
168
+ throw new TRPCError({
169
+ code: 'NOT_FOUND',
170
+ message: 'Section not found or you do not have access to this operation',
171
+ });
172
+ }
133
173
  /**
134
174
  * First, let's check if the admin exists
135
175
  */
@@ -178,7 +218,17 @@ export const adminsRouter = router({
178
218
  .input(z.object({
179
219
  id: z.string(),
180
220
  }))
181
- .mutation(async ({ input }) => {
221
+ .mutation(async ({ ctx, input }) => {
222
+ const accessAllowed = await isAccessAllowed({
223
+ sectionName: 'admins',
224
+ userId: ctx.session.user.id,
225
+ });
226
+ if (!accessAllowed) {
227
+ throw new TRPCError({
228
+ code: 'NOT_FOUND',
229
+ message: 'Section not found or you do not have access to this operation',
230
+ });
231
+ }
182
232
  const uploadsFolder = (await getCMSConfig()).media.upload.path;
183
233
  /**
184
234
  * Check if the admin is not the master admin
@@ -1 +1 @@
1
- {"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../../src/api/routers/gallery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAWxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DxB,CAAA"}
1
+ {"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../../src/api/routers/gallery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAWxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DxB,CAAA"}
@@ -25,6 +25,7 @@ export const galleryRouter = router({
25
25
  name: input.sectionName,
26
26
  admin: {
27
27
  id: ctx.session.user.id,
28
+ requiredRole: 'D',
28
29
  },
29
30
  });
30
31
  if (sectionConfig?.name !== input.sectionName) {
@@ -0,0 +1,4 @@
1
+ import { createTRPCReact } from '@trpc/react-query';
2
+ import type { AppRouter } from '../root.js';
3
+ export declare const trpc: ReturnType<typeof createTRPCReact<AppRouter>>;
4
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/trpc/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,CAAgC,CAAA"}
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ import { createTRPCReact } from '@trpc/react-query';
3
+ export const trpc = createTRPCReact();
@@ -95,5 +95,17 @@ export declare const privateProcedure: import("@trpc/server").TRPCProcedureBuild
95
95
  user: import("../index.js").User;
96
96
  };
97
97
  }, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, false>;
98
+ type PrivilegeOperation = 'C' | 'U' | 'D';
99
+ export declare const pluginProcedure: (sectionName: string, requiredRole?: PrivilegeOperation) => import("@trpc/server").TRPCProcedureBuilder<{
100
+ headers: Headers;
101
+ db: import("drizzle-orm/mysql2").MySql2Database<typeof import("../db/schema.js")> & {
102
+ $client: import("mysql2/promise").Pool;
103
+ };
104
+ session: import("../index.js").Session | null;
105
+ }, object, {
106
+ session: {
107
+ user: import("../index.js").User;
108
+ };
109
+ }, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, false>;
98
110
  export {};
99
111
  //# sourceMappingURL=trpc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trpc.d.ts","sourceRoot":"","sources":["../../src/api/trpc.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;AAKjC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAU,MAAM;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE;aAAT,OAAO;;;;;EAQ/D,CAAA;AAED,KAAK,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,OA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G,GAAG,CAAA;AA+BzC,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM,EAAE,eAAe,kBAAkB;aAvG7B,OAAO;;;;;;;;;yKAwGO,CAAA"}
package/dist/api/trpc.js CHANGED
@@ -3,6 +3,8 @@ import superjson from 'superjson';
3
3
  import { ZodError } from 'zod';
4
4
  import auth from '../auth/index.js';
5
5
  import { db } from '../db/client.js';
6
+ import { and, eq } from 'drizzle-orm';
7
+ import { AdminPrivilegesTable } from '../db/schema.js';
6
8
  /**
7
9
  * Creates context for an incoming request
8
10
  * @link https://trpc.io/docs/v11/context
@@ -67,3 +69,25 @@ export const publicProcedure = t.procedure;
67
69
  * @see https://trpc.io/docs/procedures
68
70
  */
69
71
  export const privateProcedure = t.procedure.use(isAuthedMiddleware);
72
+ const accessControlMiddleware = (sectionName, requiredRole) => isAuthedMiddleware.unstable_pipe(async ({ ctx, next }) => {
73
+ const privilege = await db
74
+ .select()
75
+ .from(AdminPrivilegesTable)
76
+ .where(and(eq(AdminPrivilegesTable.adminId, ctx.session.user.id), eq(AdminPrivilegesTable.sectionName, sectionName)))
77
+ .limit(1);
78
+ const allowed = privilege[0];
79
+ if (!allowed) {
80
+ throw new TRPCError({
81
+ code: 'NOT_FOUND',
82
+ message: 'Section not found or you do not have access to this operation',
83
+ });
84
+ }
85
+ if (requiredRole && !allowed.operations.includes(requiredRole)) {
86
+ throw new TRPCError({
87
+ code: 'NOT_FOUND',
88
+ message: 'You do not have access to this operation',
89
+ });
90
+ }
91
+ return next();
92
+ });
93
+ export const pluginProcedure = (sectionName, requiredRole) => t.procedure.use(accessControlMiddleware(sectionName, requiredRole));
@@ -1,2 +1,2 @@
1
- export * from './loader-with-esbuild.js';
1
+ export * from './loader-with-jiti.js';
2
2
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/loader.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/core/config/loader.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
@@ -1 +1 @@
1
- export * from './loader-with-esbuild.js';
1
+ export * from './loader-with-jiti.js';
@@ -1,2 +1,2 @@
1
- export * from './section-factory-with-esbuild.js';
1
+ export * from './section-factory-with-jiti.js';
2
2
  //# sourceMappingURL=SectionFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/SectionFactory.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA"}
1
+ {"version":3,"file":"SectionFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/SectionFactory.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA"}
@@ -1 +1 @@
1
- export * from './section-factory-with-esbuild.js';
1
+ export * from './section-factory-with-jiti.js';
@@ -4,10 +4,6 @@ import type { SectionTypes } from '../types/index.js';
4
4
  export declare const getSectionImportVersion: () => number;
5
5
  type AnySectionConfig = HasItemsSectionConfig | SimpleSectionConfig | CategorySectionConfig;
6
6
  export declare class SectionFactory {
7
- /**
8
- * These are the fixed sections that can not be present in the sections folder.
9
- */
10
- static readonly fixedSections: string[];
11
7
  private static readonly isDev;
12
8
  private static readonly isProd;
13
9
  private static isCLI;
@@ -1 +1 @@
1
- {"version":3,"file":"section-factory-with-esbuild.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-esbuild.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AA2CrD,eAAO,MAAM,uBAAuB,cAAoC,CAAA;AAsHxE,KAAK,g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AA;KACJ,GAAG,OAAO,CAAC;QACR,MAAM,EAAE,mBAAmB,EAAE,CAAA;QAC7B,SAAS,EAAE,qBAAqB,EAAE,CAAA;QAClC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;QACjC,KAAK,EAAE,MAAM,EAAE,CAAA;KAClB,CAAC;IA+BF;;;;;OAKG;WACU,UAAU,CAAC,EACpB,IAAI,EACJ,IAAI,GACP,EAAE;QACC,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;KACvC,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKpC;;;;;;OAMG;WACU,kBAAkB,CAAC,EAC5B,IAAI,EACJ,IAAI,EACJ,KAAK,GACR,EAAE;QACC,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;QACpC,KAAK,EAAE;YACH,EAAE,EAAE,MAAM,CAAA;YACV,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;SACjC,CAAA;KACJ,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKpC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,MAAM,eAAe,GAAG,aAAa,GAAG,eAAe,CAAA;QAC9D,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,GAAG,eAAe,GAAG,aAAa,GAAG,eAAe;IAYrD;;;;;;;;;OASG;mBACkB,GAAG;IA6FxB;;;;OAIG;mBACkB,eAAe;IAmKpC,OAAO,CAAC,MAAM,CAAC,YAAY;IAqD3B,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
1
+ {"version":3,"file":"section-factory-with-esbuild.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-esbuild.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAA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AC,YAAY;IAqD3B,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
@@ -131,10 +131,6 @@ const loadSectionModuleRuntime = async (absPath) => {
131
131
  return mod?.default;
132
132
  };
133
133
  export class SectionFactory {
134
- /**
135
- * These are the fixed sections that can not be present in the sections folder.
136
- */
137
- static fixedSections = ['admins', 'analytics', 'emails', 'dashboard'];
138
134
  static isDev = process.env.NODE_ENV !== 'production';
139
135
  static isProd = !this.isDev;
140
136
  static isCLI = false;
@@ -237,7 +233,7 @@ export class SectionFactory {
237
233
  .from(AdminPrivilegesTable)
238
234
  .where(eq(AdminPrivilegesTable.adminId, admin.id));
239
235
  const fixedSections = privileges
240
- .filter((privilege) => this.fixedSections.includes(privilege.sectionName))
236
+ .filter((privilege) => ['admins'].includes(privilege.sectionName))
241
237
  .map((privilege) => privilege.sectionName);
242
238
  const simpleSections = sections.filter((section) => section.type === 'simple');
243
239
  const hasItemsSections = sections.filter((section) => section.type === 'has_items');
@@ -4,10 +4,6 @@ import type { SectionTypes } from '../types/index.js';
4
4
  export declare const getSectionImportVersion: () => number;
5
5
  type AnySectionConfig = HasItemsSectionConfig | SimpleSectionConfig | CategorySectionConfig;
6
6
  export declare class SectionFactory {
7
- /**
8
- * These are the fixed sections that can not be present in the sections folder.
9
- */
10
- static readonly fixedSections: string[];
11
7
  private static readonly isDev;
12
8
  private static readonly isProd;
13
9
  private static isCLI;
@@ -1 +1 @@
1
- {"version":3,"file":"section-factory-with-jiti.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-jiti.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AA+BrD,eAAO,MAAM,uBAAuB,cAAo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;IAYrD;;;;;;;;;OASG;mBACkB,GAAG;IA6FxB;;;;OAIG;mBACkB,eAAe;IAmKpC,OAAO,CAAC,MAAM,CAAC,YAAY;IAwE3B;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IA0D5C,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
@@ -75,10 +75,6 @@ const loadSectionModuleRuntime = async (absPath) => {
75
75
  return mod?.default ?? mod;
76
76
  };
77
77
  export class SectionFactory {
78
- /**
79
- * These are the fixed sections that can not be present in the sections folder.
80
- */
81
- static fixedSections = ['admins', 'analytics', 'emails', 'dashboard'];
82
78
  static isDev = process.env.NODE_ENV !== 'production';
83
79
  static isProd = !this.isDev;
84
80
  static isCLI = false;
@@ -180,7 +176,7 @@ export class SectionFactory {
180
176
  .from(AdminPrivilegesTable)
181
177
  .where(eq(AdminPrivilegesTable.adminId, admin.id));
182
178
  const fixedSections = privileges
183
- .filter((privilege) => this.fixedSections.includes(privilege.sectionName))
179
+ .filter((privilege) => ['admins'].includes(privilege.sectionName))
184
180
  .map((privilege) => privilege.sectionName);
185
181
  const simpleSections = sections.filter((section) => section.type === 'simple');
186
182
  const hasItemsSections = sections.filter((section) => section.type === 'has_items');
@@ -1 +1 @@
1
- {"version":3,"file":"ItemEditSubmit.d.ts","sourceRoot":"","sources":["../../../src/core/submit/ItemEditSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAC,MAAM,aAAa,CAAC;AAItC,OAAO,KAAK,EAAuB,KAAK,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,UAAU,EAAM,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAOtC,KAAK,eAAe,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAA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AQ,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,qBAAa,UAAW,SAAQ,MAAM;IAClC,gBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAe;IAC5D,mBAA4B,OAAO,EAAE,MAAM,CAAA;IAC3C,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAK;IAE3C;;OAEG;gBACS,MAAM,EAAE,eAAe;IAKnC;;;OAGG;IACmB,UAAU;YASlB,qBAAqB;IAuBnC;;;OAGG;YACW,aAAa;YAQb,sBAAsB;IAoBpC;;;;;OAKG;cACsB,kBAAkB;IAI3C;;;;;OAKG;cACsB,cAAc;IAUvC;;;OAGG;cACgB,aAAa,IAAI,GAAG,GAAG,SAAS;IAmBnD;;;;OAIG;IACM,aAAa,CAAC,KAAK,EAAE,KAAK;IAmBnC;;;;OAIG;IACY,WAAW,CAAC,KAAK,EAAE,KAAK;IAQvC;;OAEG;IACM,iBAAiB;IAI1B;;;;OAIG;IACM,aAAa,CAAC,KAAK,EAAE,KAAK;CAgBtC"}
@@ -1,2 +1,3 @@
1
- export type { CMSPlugin, LoadedPlugin, LoadedPluginRoute, PluginInitContext, PluginModule, PluginRoute, } from './loader.js';
1
+ export type { CMSPlugin, CMSPluginMultiRoute, CMSPluginSingleRoute, LoadedPlugin, LoadedPluginRoute, PluginInitContext, PluginModule, PluginRoute, PluginRouteWithoutComponent, PluginRouteWithComponent, } from './loader.js';
2
+ export { definePlugin } from './loader.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACd,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,SAAS,EACT,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,2BAA2B,EAC3B,wBAAwB,GAC3B,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1 @@
1
+ export { definePlugin } from './loader.js';
@@ -1,6 +1,17 @@
1
1
  import type { PluginConfigEntry } from '../core/config/config-loader.js';
2
+ import type { ReactNode } from 'react';
2
3
  export interface CMSPlugin {
3
- name?: string;
4
+ /**
5
+ * The human facing title of the plugin.
6
+ * @example 'Some Plugin Title'
7
+ */
8
+ title: string;
9
+ /**
10
+ * The internal name of the plugin.
11
+ * It should start with 'plugin_' and be in snake_case.
12
+ * @example 'plugin_cpanel_emails'
13
+ */
14
+ name: string;
4
15
  version?: string;
5
16
  router?: any;
6
17
  routes?: PluginRoute[];
@@ -24,17 +35,37 @@ export interface PluginRoute {
24
35
  path: string;
25
36
  title: string;
26
37
  icon?: string;
27
- component: string;
28
- prefetch?: (helpers: {
29
- api: unknown;
30
- }) => Promise<void> | void;
38
+ component?: string;
31
39
  }
40
+ export type PluginRouteWithoutComponent = Omit<PluginRoute, 'component'> & {
41
+ component?: never;
42
+ };
43
+ export type PluginRouteWithComponent = PluginRoute & {
44
+ component: string;
45
+ };
32
46
  export interface LoadedPluginRoute extends PluginRoute {
33
47
  pluginId: string;
34
- pluginName?: string;
48
+ pluginName: string;
49
+ pluginTitle: string;
35
50
  }
51
+ type CMSPluginBase = Omit<CMSPlugin, 'routes'>;
52
+ export type CMSPluginSingleRoute = CMSPluginBase & {
53
+ routes?: [] | [PluginRouteWithoutComponent];
54
+ };
55
+ export type CMSPluginMultiRoute = CMSPluginBase & {
56
+ routes: [PluginRouteWithComponent, PluginRouteWithComponent, ...PluginRouteWithComponent[]];
57
+ };
58
+ export declare function definePlugin(plugin: CMSPluginSingleRoute): CMSPluginSingleRoute;
59
+ export declare function definePlugin(plugin: CMSPluginMultiRoute): CMSPluginMultiRoute;
36
60
  export declare const loadPluginModule: (pluginPackage: string) => Promise<unknown>;
37
61
  export declare function loadPlugins(): Promise<LoadedPlugin[]>;
38
62
  export declare function getPluginRoutes(): Promise<LoadedPluginRoute[]>;
39
63
  export declare function findPluginRouteByPath(path: string): Promise<LoadedPluginRoute | null>;
64
+ type PluginServerComponent = (props?: Record<string, unknown>) => ReactNode | Promise<ReactNode>;
65
+ type PluginServerModule = {
66
+ default?: PluginServerComponent;
67
+ [key: string]: unknown;
68
+ };
69
+ export declare const pluginServerLoaders: Record<string, () => Promise<PluginServerModule>>;
70
+ export {};
40
71
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/plugins/loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAGxE,MAAM,WAAW,SAAS;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAC1D;AAED,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,iBAAiB,CAAA;CAC5B;AAED,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,iBAAiB,CAAA;IACzB,MAAM,EAAE,SAAS,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IACzB,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS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A2B,CAAC,CAAA;CAC9C,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAC9C,MAAM,EAAE,CAAC,wBAAwB,EAAE,wBAAwB,EAAE,GAAG,wBAAwB,EAAE,CAAC,CAAA;CAC9F,CAAA;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,CAAA;AAChF,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAAA;AA2C9E,eAAO,MAAM,gBAAgB,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,OAAO,CAwB7E,CAAA;AA6BD,wBAAsB,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAyE3D;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA6BpE;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAI3F;AACD,KAAK,qBAAqB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAEhG,KAAK,kBAAkB,GAAG;IACtB,OAAO,CAAC,EAAE,qBAAqB,CAAA;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAOjF,CAAA"}
@@ -5,6 +5,10 @@ if (typeof window !== 'undefined') {
5
5
  import { createRequire } from 'module';
6
6
  import path from 'path';
7
7
  import { getCMSConfig, getConfigImportVersion } from '../core/config/index.js';
8
+ import chalk from 'chalk';
9
+ export function definePlugin(plugin) {
10
+ return plugin;
11
+ }
8
12
  const deriveRouterKey = (packageName) => {
9
13
  const baseName = packageName.split('/').pop() ?? packageName;
10
14
  const withoutPrefix = baseName.startsWith('plugin-') ? baseName.slice('plugin-'.length) : baseName;
@@ -69,8 +73,13 @@ function resolvePluginInstance(registration, mod) {
69
73
  console.warn(`[plugins] Plugin "${registration.package}" did not return a plugin instance`);
70
74
  return null;
71
75
  }
76
+ if (!candidate.name || !candidate.title) {
77
+ console.warn(`[plugins] Plugin "${registration.package}" is missing required "name" or "title". Skipping.`);
78
+ return null;
79
+ }
72
80
  return {
73
- name: candidate.name ?? registration.package,
81
+ title: candidate.title,
82
+ name: candidate.name,
74
83
  version: candidate.version,
75
84
  router: candidate.router,
76
85
  routes: candidate.routes ?? [],
@@ -92,6 +101,12 @@ export async function loadPlugins() {
92
101
  const seenRouterKeys = new Set();
93
102
  const loaded = [];
94
103
  for (const registration of registrations) {
104
+ if (!registration.package) {
105
+ console.warn(`[plugins] Plugin registration is missing "package" field.`);
106
+ console.warn(`[plugins] Please check your cms.config.ts file.`);
107
+ console.warn(`[plugins] Skipping this plugin registration.`);
108
+ continue;
109
+ }
95
110
  const mod = await loadPluginModule(registration.package);
96
111
  if (!mod)
97
112
  continue;
@@ -138,13 +153,22 @@ export async function loadPlugins() {
138
153
  export async function getPluginRoutes() {
139
154
  const loaded = await loadPlugins();
140
155
  return loaded.flatMap((entry) => {
141
- const pluginId = entry.config.package;
142
- const pluginName = entry.plugin.name ?? entry.config.package;
143
- return (entry.plugin.routes ?? []).map((route) => ({
144
- ...route,
145
- pluginId,
146
- pluginName,
147
- }));
156
+ const routes = entry.plugin.routes ?? [];
157
+ const requireComponent = routes.length > 1;
158
+ return routes.map((route) => {
159
+ if (requireComponent && !route.component) {
160
+ console.warn(chalk.red(`[plugins] Route "${route.path}" from "${entry.config.package}" should set "component" because the plugin defines multiple routes.`));
161
+ }
162
+ if (!requireComponent && route.component) {
163
+ console.warn(chalk.gray(`[plugins] Route "${route.path}" from "${entry.config.package}" should omit "component" and export a default component, because the plugin defines a single route.`));
164
+ }
165
+ return {
166
+ ...route,
167
+ pluginId: entry.config.package,
168
+ pluginName: entry.plugin.name,
169
+ pluginTitle: entry.plugin.title,
170
+ };
171
+ });
148
172
  });
149
173
  }
150
174
  export async function findPluginRouteByPath(path) {
@@ -152,3 +176,12 @@ export async function findPluginRouteByPath(path) {
152
176
  const routes = await getPluginRoutes();
153
177
  return routes.find((route) => route.path === normalized) ?? null;
154
178
  }
179
+ // Keep this list in sync with cms.config.ts and apps/cms/package.json.
180
+ export const pluginServerLoaders = {
181
+ // @ts-ignore - The package should be in dependencies if you want to use it
182
+ '@nextjs-cms-plugins/cpanel-dashboard': () => import('@nextjs-cms-plugins/cpanel-dashboard/server'),
183
+ // @ts-ignore - The package should be in dependencies if you want to use it
184
+ '@nextjs-cms-plugins/cpanel-emails': () => import('@nextjs-cms-plugins/cpanel-emails/server'),
185
+ // @ts-ignore - The package should be in dependencies if you want to use it
186
+ '@nextjs-cms-plugins/google-analytics': () => import('@nextjs-cms-plugins/google-analytics/server'),
187
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextjs-cms",
3
- "version": "0.5.68",
3
+ "version": "0.5.69",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -26,6 +26,10 @@
26
26
  "types": "./dist/api/trpc/server.d.ts",
27
27
  "default": "./dist/api/trpc/server.js"
28
28
  },
29
+ "./api/trpc/client": {
30
+ "types": "./dist/api/trpc/client.d.ts",
31
+ "default": "./dist/api/trpc/client.js"
32
+ },
29
33
  "./auth": {
30
34
  "types": "./dist/auth/index.d.ts",
31
35
  "default": "./dist/auth/index.js"
@@ -162,9 +166,9 @@
162
166
  "prettier": "^3.3.3",
163
167
  "tsx": "^4.20.6",
164
168
  "typescript": "^5.9.2",
165
- "@lzcms/eslint-config": "0.3.0",
166
169
  "@lzcms/prettier-config": "0.1.0",
167
- "@lzcms/tsconfig": "0.1.0"
170
+ "@lzcms/tsconfig": "0.1.0",
171
+ "@lzcms/eslint-config": "0.3.0"
168
172
  },
169
173
  "license": "MIT",
170
174
  "keywords": [
@@ -1,29 +0,0 @@
1
- export declare const googleAnalyticsRouter: import("@trpc/server").TRPCBuiltRouter<{
2
- ctx: {
3
- headers: Headers;
4
- db: import("drizzle-orm/mysql2").MySql2Database<typeof import("../../db/schema.js")> & {
5
- $client: import("mysql2/promise").Pool;
6
- };
7
- session: import("../../index.js").Session | null;
8
- };
9
- meta: object;
10
- errorShape: {
11
- data: {
12
- zodError: import("zod").ZodFlattenedError<unknown, string> | null;
13
- code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
14
- httpStatus: number;
15
- path?: string;
16
- stack?: string;
17
- };
18
- message: string;
19
- code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
20
- };
21
- transformer: true;
22
- }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
23
- test: import("@trpc/server").TRPCQueryProcedure<{
24
- input: void;
25
- output: boolean;
26
- meta: object;
27
- }>;
28
- }>>;
29
- //# sourceMappingURL=googleAnalytics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"googleAnalytics.d.ts","sourceRoot":"","sources":["../../../src/api/routers/googleAnalytics.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIhC,CAAA"}
@@ -1,7 +0,0 @@
1
- import { privateProcedure, router } from '../trpc.js';
2
- // import { BetaAnalyticsDataClient } from '@google-analytics/data'
3
- export const googleAnalyticsRouter = router({
4
- test: privateProcedure.query(async ({ ctx }) => {
5
- return true;
6
- }),
7
- });