nextjs-cms 0.5.92 → 0.5.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +2 -2
- package/dist/api/lib/serverActions.d.ts.map +1 -1
- package/dist/api/lib/serverActions.js +5 -4
- package/dist/api/root.d.ts +4 -4
- package/dist/api/routers/admins.js +11 -11
- package/dist/api/routers/auth.d.ts +2 -2
- package/dist/api/routers/cpanel.js +7 -7
- package/dist/api/routers/gallery.js +1 -1
- package/dist/api/routers/logs.d.ts.map +1 -1
- package/dist/api/routers/logs.js +2 -1
- package/dist/api/trpc.d.ts.map +1 -1
- package/dist/api/trpc.js +3 -2
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/lib/actions.d.ts +3 -3
- package/dist/auth/lib/actions.js +3 -3
- package/dist/core/factories/FieldFactory.d.ts.map +1 -1
- package/dist/core/factories/FieldFactory.js +2 -1
- package/dist/core/fields/photo.d.ts +6 -6
- package/dist/core/fields/richText.d.ts +9 -9
- package/dist/core/fields/select.d.ts +1 -1
- package/dist/core/sections/category.d.ts +4 -4
- package/dist/core/sections/hasItems.d.ts +10 -10
- package/dist/core/sections/section.d.ts +2 -2
- package/dist/core/sections/section.js +5 -5
- package/dist/core/sections/simple.d.ts +2 -2
- package/dist/core/submit/submit.d.ts.map +1 -1
- package/dist/core/submit/submit.js +2 -1
- package/dist/db/schema.d.ts +1 -1
- package/dist/db/schema.js +1 -1
- package/dist/translations/client.d.ts +2 -0
- package/dist/translations/client.d.ts.map +1 -0
- package/dist/translations/client.js +6 -0
- package/dist/translations/dictionaries/ar.d.ts +352 -0
- package/dist/translations/dictionaries/ar.d.ts.map +1 -0
- package/dist/translations/dictionaries/ar.js +350 -0
- package/dist/translations/dictionaries/en.d.ts +352 -0
- package/dist/translations/dictionaries/en.d.ts.map +1 -0
- package/dist/translations/dictionaries/en.js +350 -0
- package/dist/translations/index.d.ts +6 -0
- package/dist/translations/index.d.ts.map +1 -1
- package/dist/translations/index.js +8 -2
- package/dist/translations/server.d.ts +2 -0
- package/dist/translations/server.d.ts.map +1 -0
- package/dist/translations/server.js +5 -0
- package/package.json +10 -1
- package/dist/translations/dictionaries/ar.json +0 -287
- package/dist/translations/dictionaries/en.json +0 -287
package/dist/api/index.d.ts
CHANGED
|
@@ -64,13 +64,13 @@ declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
64
64
|
user: {
|
|
65
65
|
id: string;
|
|
66
66
|
name: string;
|
|
67
|
-
locale: string
|
|
67
|
+
locale: string;
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
70
|
user: {
|
|
71
71
|
id: string;
|
|
72
72
|
username: string;
|
|
73
|
-
lang: string
|
|
73
|
+
lang: string;
|
|
74
74
|
avatar: string | null;
|
|
75
75
|
};
|
|
76
76
|
accessToken: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverActions.d.ts","sourceRoot":"","sources":["../../../src/api/lib/serverActions.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"serverActions.d.ts","sourceRoot":"","sources":["../../../src/api/lib/serverActions.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAGxE,eAAO,MAAM,eAAe,GAAU,gCAInC;IACC,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;CACjB,qBAmBA,CAAA;AACD,eAAO,MAAM,WAAW,GACpB,SAAS,OAAO,EAChB,OAAO;IAAE,IAAI,EAAE,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import { getCMSConfig } from '../../core/config/index.js';
|
|
|
16
16
|
import { getPluginRoutes } from '../../plugins/loader.js';
|
|
17
17
|
import through2 from 'through2';
|
|
18
18
|
import { recordLog } from '../../logging/index.js';
|
|
19
|
+
import getString from '../../translations/index.js';
|
|
19
20
|
export const isAccessAllowed = async ({ sectionName, role, userId, }) => {
|
|
20
21
|
/**
|
|
21
22
|
* Check admin privileges
|
|
@@ -365,7 +366,7 @@ export const deleteSectionItem = async (session, sectionName, sectionItemId, rec
|
|
|
365
366
|
if (!section) {
|
|
366
367
|
return {
|
|
367
368
|
error: {
|
|
368
|
-
message: '
|
|
369
|
+
message: getString('sectionNotFound', session.user.locale),
|
|
369
370
|
},
|
|
370
371
|
};
|
|
371
372
|
}
|
|
@@ -713,7 +714,7 @@ export const getCategorySectionChildren = async ({ session, id, sectionName, lev
|
|
|
713
714
|
if (!section) {
|
|
714
715
|
return {
|
|
715
716
|
error: {
|
|
716
|
-
message: '
|
|
717
|
+
message: getString('sectionNotFound', session.user.locale),
|
|
717
718
|
},
|
|
718
719
|
};
|
|
719
720
|
}
|
|
@@ -761,7 +762,7 @@ export const getCategorySection = async (session, sectionName) => {
|
|
|
761
762
|
if (!section) {
|
|
762
763
|
return {
|
|
763
764
|
error: {
|
|
764
|
-
message: '
|
|
765
|
+
message: getString('sectionNotFound', session.user.locale),
|
|
765
766
|
},
|
|
766
767
|
};
|
|
767
768
|
}
|
|
@@ -820,7 +821,7 @@ export const getBrowsePage = async (session, sectionName, page = 1, q) => {
|
|
|
820
821
|
if (!section) {
|
|
821
822
|
return {
|
|
822
823
|
error: {
|
|
823
|
-
message: '
|
|
824
|
+
message: getString('sectionNotFound', session.user.locale),
|
|
824
825
|
},
|
|
825
826
|
};
|
|
826
827
|
}
|
package/dist/api/root.d.ts
CHANGED
|
@@ -55,13 +55,13 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
55
55
|
user: {
|
|
56
56
|
id: string;
|
|
57
57
|
name: string;
|
|
58
|
-
locale: string
|
|
58
|
+
locale: string;
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
user: {
|
|
62
62
|
id: string;
|
|
63
63
|
username: string;
|
|
64
|
-
lang: string
|
|
64
|
+
lang: string;
|
|
65
65
|
avatar: string | null;
|
|
66
66
|
};
|
|
67
67
|
accessToken: string;
|
|
@@ -890,13 +890,13 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
890
890
|
user: {
|
|
891
891
|
id: string;
|
|
892
892
|
name: string;
|
|
893
|
-
locale: string
|
|
893
|
+
locale: string;
|
|
894
894
|
};
|
|
895
895
|
};
|
|
896
896
|
user: {
|
|
897
897
|
id: string;
|
|
898
898
|
username: string;
|
|
899
|
-
lang: string
|
|
899
|
+
lang: string;
|
|
900
900
|
avatar: string | null;
|
|
901
901
|
};
|
|
902
902
|
accessToken: string;
|
|
@@ -21,7 +21,7 @@ export const adminsRouter = router({
|
|
|
21
21
|
if (!accessAllowed) {
|
|
22
22
|
return {
|
|
23
23
|
error: {
|
|
24
|
-
message: '
|
|
24
|
+
message: getString('sectionNotFound', ctx.session.user.locale),
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -41,7 +41,7 @@ export const adminsRouter = router({
|
|
|
41
41
|
if (!accessAllowed) {
|
|
42
42
|
throw new TRPCError({
|
|
43
43
|
code: 'NOT_FOUND',
|
|
44
|
-
message: '
|
|
44
|
+
message: getString('sectionNotFound', opts.ctx.session.user.locale),
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
const data = await Promise.all([
|
|
@@ -97,7 +97,7 @@ export const adminsRouter = router({
|
|
|
97
97
|
if (!accessAllowed) {
|
|
98
98
|
throw new TRPCError({
|
|
99
99
|
code: 'NOT_FOUND',
|
|
100
|
-
message: '
|
|
100
|
+
message: getString('sectionNotFound', ctx.session.user.locale),
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
@@ -110,7 +110,7 @@ export const adminsRouter = router({
|
|
|
110
110
|
if (usernameExists.length > 0) {
|
|
111
111
|
throw new TRPCError({
|
|
112
112
|
code: 'BAD_REQUEST',
|
|
113
|
-
message: getString('adminAlreadyExists'),
|
|
113
|
+
message: getString('adminAlreadyExists', ctx.session.user.locale),
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
@@ -123,7 +123,7 @@ export const adminsRouter = router({
|
|
|
123
123
|
if (filteredPrivileges.length === 0) {
|
|
124
124
|
throw new TRPCError({
|
|
125
125
|
code: 'BAD_REQUEST',
|
|
126
|
-
message: getString('selectAtLeastOnePrivilege'),
|
|
126
|
+
message: getString('selectAtLeastOnePrivilege', ctx.session.user.locale),
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
@@ -188,7 +188,7 @@ export const adminsRouter = router({
|
|
|
188
188
|
if (!accessAllowed) {
|
|
189
189
|
throw new TRPCError({
|
|
190
190
|
code: 'NOT_FOUND',
|
|
191
|
-
message: '
|
|
191
|
+
message: getString('sectionNotFound', ctx.session.user.locale),
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
@@ -202,7 +202,7 @@ export const adminsRouter = router({
|
|
|
202
202
|
if (!admin) {
|
|
203
203
|
throw new TRPCError({
|
|
204
204
|
code: 'BAD_REQUEST',
|
|
205
|
-
message: getString('adminDoesNotExist'),
|
|
205
|
+
message: getString('adminDoesNotExist', ctx.session.user.locale),
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -215,7 +215,7 @@ export const adminsRouter = router({
|
|
|
215
215
|
if (filteredPrivileges.length === 0) {
|
|
216
216
|
throw new TRPCError({
|
|
217
217
|
code: 'BAD_REQUEST',
|
|
218
|
-
message: getString('selectAtLeastOnePrivilege'),
|
|
218
|
+
message: getString('selectAtLeastOnePrivilege', ctx.session.user.locale),
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
@@ -266,7 +266,7 @@ export const adminsRouter = router({
|
|
|
266
266
|
if (!accessAllowed) {
|
|
267
267
|
throw new TRPCError({
|
|
268
268
|
code: 'NOT_FOUND',
|
|
269
|
-
message: '
|
|
269
|
+
message: getString('sectionNotFound', ctx.session.user.locale),
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
const uploadsFolder = (await getCMSConfig()).media.upload.path;
|
|
@@ -276,7 +276,7 @@ export const adminsRouter = router({
|
|
|
276
276
|
if (input.id === '1') {
|
|
277
277
|
throw new TRPCError({
|
|
278
278
|
code: 'BAD_REQUEST',
|
|
279
|
-
message: getString('masterAdminCannotBeDeleted'),
|
|
279
|
+
message: getString('masterAdminCannotBeDeleted', ctx.session.user.locale),
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
@@ -287,7 +287,7 @@ export const adminsRouter = router({
|
|
|
287
287
|
if (!admin) {
|
|
288
288
|
throw new TRPCError({
|
|
289
289
|
code: 'BAD_REQUEST',
|
|
290
|
-
message: getString('adminNotFound'),
|
|
290
|
+
message: getString('adminNotFound', ctx.session.user.locale),
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
@@ -32,13 +32,13 @@ export declare const authRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
32
32
|
user: {
|
|
33
33
|
id: string;
|
|
34
34
|
name: string;
|
|
35
|
-
locale: string
|
|
35
|
+
locale: string;
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
user: {
|
|
39
39
|
id: string;
|
|
40
40
|
username: string;
|
|
41
|
-
lang: string
|
|
41
|
+
lang: string;
|
|
42
42
|
avatar: string | null;
|
|
43
43
|
};
|
|
44
44
|
accessToken: string;
|
|
@@ -9,7 +9,7 @@ export const cpanelRouter = router({
|
|
|
9
9
|
if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
|
|
10
10
|
throw new TRPCError({
|
|
11
11
|
code: 'BAD_REQUEST',
|
|
12
|
-
message: getString('cpanelCredentialsNotSet'),
|
|
12
|
+
message: getString('cpanelCredentialsNotSet', ctx.session.user.locale),
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
const cPanel = new CpanelAPI(process.env.CPANEL_USER, process.env.CPANEL_PASSWORD, `cpanel.${process.env.CPANEL_DOMAIN}`);
|
|
@@ -90,7 +90,7 @@ export const cpanelRouter = router({
|
|
|
90
90
|
if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
|
|
91
91
|
throw new TRPCError({
|
|
92
92
|
code: 'BAD_REQUEST',
|
|
93
|
-
message: getString('cpanelCredentialsNotSet'),
|
|
93
|
+
message: getString('cpanelCredentialsNotSet', ctx.session.user.locale),
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
const cPanel = new CpanelAPI(process.env.CPANEL_USER, process.env.CPANEL_PASSWORD, `cpanel.${process.env.CPANEL_DOMAIN}`);
|
|
@@ -116,7 +116,7 @@ export const cpanelRouter = router({
|
|
|
116
116
|
if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
|
|
117
117
|
throw new TRPCError({
|
|
118
118
|
code: 'BAD_REQUEST',
|
|
119
|
-
message: getString('cpanelCredentialsNotSet'),
|
|
119
|
+
message: getString('cpanelCredentialsNotSet', ctx.session.user.locale),
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
const cPanel = new CpanelAPI(process.env.CPANEL_USER, process.env.CPANEL_PASSWORD, `cpanel.${process.env.CPANEL_DOMAIN}`);
|
|
@@ -143,7 +143,7 @@ export const cpanelRouter = router({
|
|
|
143
143
|
if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
|
|
144
144
|
throw new TRPCError({
|
|
145
145
|
code: 'BAD_REQUEST',
|
|
146
|
-
message: getString('cpanelCredentialsNotSet'),
|
|
146
|
+
message: getString('cpanelCredentialsNotSet', ctx.session.user.locale),
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
const cPanel = new CpanelAPI(process.env.CPANEL_USER, process.env.CPANEL_PASSWORD, `cpanel.${process.env.CPANEL_DOMAIN}`);
|
|
@@ -170,13 +170,13 @@ export const cpanelRouter = router({
|
|
|
170
170
|
if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
|
|
171
171
|
throw new TRPCError({
|
|
172
172
|
code: 'BAD_REQUEST',
|
|
173
|
-
message: getString('cpanelCredentialsNotSet'),
|
|
173
|
+
message: getString('cpanelCredentialsNotSet', ctx.session.user.locale),
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
if (input.password !== input.passwordConfirm) {
|
|
177
177
|
throw new TRPCError({
|
|
178
178
|
code: 'BAD_REQUEST',
|
|
179
|
-
message: getString('passwordsDoNotMatch'),
|
|
179
|
+
message: getString('passwordsDoNotMatch', ctx.session.user.locale),
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
const cPanel = new CpanelAPI(process.env.CPANEL_USER, process.env.CPANEL_PASSWORD, `cpanel.${process.env.CPANEL_DOMAIN}`);
|
|
@@ -197,7 +197,7 @@ export const cpanelRouter = router({
|
|
|
197
197
|
if (!process.env.CPANEL_USER || !process.env.CPANEL_PASSWORD || !process.env.CPANEL_DOMAIN) {
|
|
198
198
|
throw new TRPCError({
|
|
199
199
|
code: 'BAD_REQUEST',
|
|
200
|
-
message: getString('cpanelCredentialsNotSet'),
|
|
200
|
+
message: getString('cpanelCredentialsNotSet', ctx.session.user.locale),
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
const cPanel = new CpanelAPI(process.env.CPANEL_USER, process.env.CPANEL_PASSWORD, `cpanel.${process.env.CPANEL_DOMAIN}`);
|
|
@@ -31,7 +31,7 @@ export const galleryRouter = router({
|
|
|
31
31
|
if (sectionConfig?.name !== input.sectionName) {
|
|
32
32
|
throw new TRPCError({
|
|
33
33
|
code: 'BAD_REQUEST',
|
|
34
|
-
message: getString('sectionNotFound'),
|
|
34
|
+
message: getString('sectionNotFound', ctx.session.user.locale),
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
const section = sectionConfig?.build();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/api/routers/logs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/api/routers/logs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAqBxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DrB,CAAA"}
|
package/dist/api/routers/logs.js
CHANGED
|
@@ -5,6 +5,7 @@ import { db } from '../../db/client.js';
|
|
|
5
5
|
import { LogsTable } from '../../db/schema.js';
|
|
6
6
|
import { isAccessAllowed } from '../lib/serverActions.js';
|
|
7
7
|
import { privateProcedure, router } from '../trpc.js';
|
|
8
|
+
import getString from '../../translations/index.js';
|
|
8
9
|
const listInputSchema = z
|
|
9
10
|
.object({
|
|
10
11
|
limit: z.number().min(1).max(200).optional(),
|
|
@@ -27,7 +28,7 @@ export const logsRouter = router({
|
|
|
27
28
|
if (!accessAllowed) {
|
|
28
29
|
throw new TRPCError({
|
|
29
30
|
code: 'NOT_FOUND',
|
|
30
|
-
message: '
|
|
31
|
+
message: getString('sectionNotFound', ctx.session.user.locale),
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
const limit = input?.limit ?? 50;
|
package/dist/api/trpc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trpc.d.ts","sourceRoot":"","sources":["../../src/api/trpc.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"trpc.d.ts","sourceRoot":"","sources":["../../src/api/trpc.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;AAQjC;;;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,OAAO,iBAAiB,CAAC,CAAC,CAAA;AAC5D,MAAM,MAAM,WAAW,GAAG,OAAO,CAAA;AAEjC,eAAO,MAAM,WAAW;;;CAGvB,CAAA;AAkBD;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;iBAtCyB,OAAO;;;;;;;;;;;;;;;;;;;EAsCR,CAAA;AAiBxD;;;GAGG;AACH,eAAO,MAAM,MAAM;;iBA3DsC,OAAO;;;;;;;;;;;;;;;;;;;EA2DlC,CAAA;AAE9B;;GAEG;AACH,eAAO,MAAM,eAAe;aAhE6B,OAAO;;;;;yLAgEtB,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,gBAAgB;aAtE4B,OAAO;;;;;;;;;yKAsEG,CAAA;AAEnE,KAAK,kBAAkB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AA+BzC,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM,EAAE,eAAe,kBAAkB;aAvG7B,OAAO;;;;;;;;;yKAwGO,CAAA"}
|
package/dist/api/trpc.js
CHANGED
|
@@ -5,6 +5,7 @@ import auth from '../auth/index.js';
|
|
|
5
5
|
import { db } from '../db/client.js';
|
|
6
6
|
import { and, eq } from 'drizzle-orm';
|
|
7
7
|
import { AdminPrivilegesTable } from '../db/schema.js';
|
|
8
|
+
import getString from '../translations/index.js';
|
|
8
9
|
/**
|
|
9
10
|
* Creates context for an incoming request
|
|
10
11
|
* @link https://trpc.io/docs/v11/context
|
|
@@ -79,13 +80,13 @@ const accessControlMiddleware = (sectionName, requiredRole) => isAuthedMiddlewar
|
|
|
79
80
|
if (!allowed) {
|
|
80
81
|
throw new TRPCError({
|
|
81
82
|
code: 'NOT_FOUND',
|
|
82
|
-
message: '
|
|
83
|
+
message: getString('sectionNotFound', ctx.session.user.locale),
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
if (requiredRole && !allowed.operations.includes(requiredRole)) {
|
|
86
87
|
throw new TRPCError({
|
|
87
88
|
code: 'NOT_FOUND',
|
|
88
|
-
message: '
|
|
89
|
+
message: getString('noAccessToThisOperation', ctx.session.user.locale),
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
return next();
|
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,IAAI,CAAA;CACb;AAED,MAAM,WAAW,IAAI;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,IAAI,CAAA;CACb;AAED,MAAM,WAAW,IAAI;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAeD;;GAEG;AACH,iBAAe,gBAAgB,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAczD;AAED;;GAEG;AACH,QAAA,MAAM,IAAI,yBAA0B,CAAA;AAEpC;;GAEG;AACH,eAAe,IAAI,CAAA"}
|
|
@@ -14,7 +14,7 @@ export declare const authRefresh: (refreshToken?: {
|
|
|
14
14
|
user: {
|
|
15
15
|
id: string;
|
|
16
16
|
username: string;
|
|
17
|
-
lang: string
|
|
17
|
+
lang: string;
|
|
18
18
|
avatar: string | null;
|
|
19
19
|
};
|
|
20
20
|
code?: undefined;
|
|
@@ -28,13 +28,13 @@ export declare const login: ({ username, password }: {
|
|
|
28
28
|
user: {
|
|
29
29
|
id: string;
|
|
30
30
|
name: string;
|
|
31
|
-
locale: string
|
|
31
|
+
locale: string;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
user: {
|
|
35
35
|
id: string;
|
|
36
36
|
username: string;
|
|
37
|
-
lang: string
|
|
37
|
+
lang: string;
|
|
38
38
|
avatar: string | null;
|
|
39
39
|
};
|
|
40
40
|
accessToken: string;
|
package/dist/auth/lib/actions.js
CHANGED
|
@@ -42,7 +42,7 @@ export const authRefresh = async (refreshToken) => {
|
|
|
42
42
|
iss: 'nextjs-cms',
|
|
43
43
|
aud: 'admin',
|
|
44
44
|
sub: adminTokenResult.username,
|
|
45
|
-
locale: adminTokenResult.locale
|
|
45
|
+
locale: adminTokenResult.locale,
|
|
46
46
|
});
|
|
47
47
|
const newRefreshToken = encodeRefreshToken({
|
|
48
48
|
id: adminTokenResult.adminId,
|
|
@@ -89,7 +89,7 @@ export const authRefresh = async (refreshToken) => {
|
|
|
89
89
|
user: {
|
|
90
90
|
id: adminTokenResult.adminId,
|
|
91
91
|
name: adminTokenResult.username,
|
|
92
|
-
locale: adminTokenResult.locale
|
|
92
|
+
locale: adminTokenResult.locale,
|
|
93
93
|
},
|
|
94
94
|
};
|
|
95
95
|
return {
|
|
@@ -142,7 +142,7 @@ export const login = async ({ username, password }) => {
|
|
|
142
142
|
iss: 'nextjs-cms',
|
|
143
143
|
aud: 'admin',
|
|
144
144
|
sub: admin.username,
|
|
145
|
-
locale: admin.locale
|
|
145
|
+
locale: admin.locale,
|
|
146
146
|
});
|
|
147
147
|
const refreshToken = encodeRefreshToken({
|
|
148
148
|
id: admin.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/FieldFactory.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../src/core/factories/FieldFactory.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAGnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,KAAK,eAAe,GACd;IACI,IAAI,EAAE,KAAK,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,KAAK,CAAA;CACjB,GACD;IACI,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,CAAA;AAEP,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,MAAM,CAAyC;IACvD,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,aAAa,CAAa;IAClC,SAAS,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;IAC9B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAA;IAC7B,OAAO,CAAC,YAAY,CAA4B;IAGhD;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAY;IAEjD;;OAEG;gBACS,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,eAAe;IASnE;;OAEG;IACU,UAAU;YAUT,aAAa;YASb,qBAAqB;IAwFnC;;;;OAIG;YACW,qBAAqB;IAuCnC;;;;OAIG;YACW,cAAc;IAuB5B;;;;;OAKG;YACW,YAAY;IAiB1B,OAAO,CAAC,kBAAkB;IAa1B;;OAEG;IACU,cAAc;IAqB3B;;;OAGG;IACH,OAAO,CAAC,UAAU;IA4ElB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;;OAGG;IACI,gBAAgB;;;;;;;;;;;;;;;IAmEvB,IAAI,WAAW,IAAI,OAAO,GAAG,SAAS,CAErC;IACD,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,KAAK,IAAI,OAAO,CAEnB;CACJ"}
|
|
@@ -6,6 +6,7 @@ import { checkboxField, SelectField, SelectMultipleField, TagsField } from '../f
|
|
|
6
6
|
import { is } from '../helpers/index.js';
|
|
7
7
|
import { cloneDeep } from 'lodash-es';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
|
+
import getString from '../../translations/index.js';
|
|
9
10
|
export class FieldFactory {
|
|
10
11
|
session;
|
|
11
12
|
_values = {};
|
|
@@ -185,7 +186,7 @@ export class FieldFactory {
|
|
|
185
186
|
});
|
|
186
187
|
if (!s || !s.name) {
|
|
187
188
|
this._error = true;
|
|
188
|
-
this._errorMessage = '
|
|
189
|
+
this._errorMessage = getString('sectionNotFound', session.user.locale);
|
|
189
190
|
return undefined;
|
|
190
191
|
}
|
|
191
192
|
return s;
|
|
@@ -54,10 +54,10 @@ declare const configSchema: z.ZodObject<{
|
|
|
54
54
|
* @hint 'jpg' is an alias for 'jpeg'
|
|
55
55
|
*/
|
|
56
56
|
fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
57
|
-
|
|
57
|
+
webp: "webp";
|
|
58
58
|
jpg: "jpg";
|
|
59
|
+
jpeg: "jpeg";
|
|
59
60
|
png: "png";
|
|
60
|
-
webp: "webp";
|
|
61
61
|
}>>>;
|
|
62
62
|
/**
|
|
63
63
|
* Remove the extension from the file name
|
|
@@ -201,10 +201,10 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
201
201
|
* @hint 'jpg' is an alias for 'jpeg'
|
|
202
202
|
*/
|
|
203
203
|
fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
204
|
-
|
|
204
|
+
webp: "webp";
|
|
205
205
|
jpg: "jpg";
|
|
206
|
+
jpeg: "jpeg";
|
|
206
207
|
png: "png";
|
|
207
|
-
webp: "webp";
|
|
208
208
|
}>>>;
|
|
209
209
|
/**
|
|
210
210
|
* Remove the extension from the file name
|
|
@@ -273,10 +273,10 @@ declare const photoFieldConfigSchema: z.ZodObject<{
|
|
|
273
273
|
* @hint 'jpg' is an alias for 'jpeg'
|
|
274
274
|
*/
|
|
275
275
|
fileType: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
276
|
-
|
|
276
|
+
webp: "webp";
|
|
277
277
|
jpg: "jpg";
|
|
278
|
+
jpeg: "jpeg";
|
|
278
279
|
png: "png";
|
|
279
|
-
webp: "webp";
|
|
280
280
|
}>>>;
|
|
281
281
|
/**
|
|
282
282
|
* Remove the extension from the file name
|
|
@@ -31,10 +31,10 @@ declare const allowImageUploadsSchema: z.ZodObject<{
|
|
|
31
31
|
*/
|
|
32
32
|
omitExtension: z.ZodOptional<z.ZodBoolean>;
|
|
33
33
|
format: z.ZodOptional<z.ZodEnum<{
|
|
34
|
-
|
|
34
|
+
webp: "webp";
|
|
35
35
|
jpg: "jpg";
|
|
36
|
+
jpeg: "jpeg";
|
|
36
37
|
png: "png";
|
|
37
|
-
webp: "webp";
|
|
38
38
|
}>>;
|
|
39
39
|
}, z.core.$strict>;
|
|
40
40
|
declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -72,10 +72,10 @@ declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
72
72
|
*/
|
|
73
73
|
omitExtension: z.ZodOptional<z.ZodBoolean>;
|
|
74
74
|
format: z.ZodOptional<z.ZodEnum<{
|
|
75
|
-
|
|
75
|
+
webp: "webp";
|
|
76
76
|
jpg: "jpg";
|
|
77
|
+
jpeg: "jpeg";
|
|
77
78
|
png: "png";
|
|
78
|
-
webp: "webp";
|
|
79
79
|
}>>;
|
|
80
80
|
}, z.core.$strict>>;
|
|
81
81
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -118,7 +118,7 @@ export declare class RichTextField extends Field<'rich_text', Config> {
|
|
|
118
118
|
} | undefined;
|
|
119
119
|
handleMethod?: "base64" | "tempSave" | undefined;
|
|
120
120
|
omitExtension?: boolean | undefined;
|
|
121
|
-
format?: "
|
|
121
|
+
format?: "webp" | "jpg" | "jpeg" | "png" | undefined;
|
|
122
122
|
};
|
|
123
123
|
sanitize: boolean;
|
|
124
124
|
type: "rich_text";
|
|
@@ -186,10 +186,10 @@ declare const optionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
186
186
|
*/
|
|
187
187
|
omitExtension: z.ZodOptional<z.ZodBoolean>;
|
|
188
188
|
format: z.ZodOptional<z.ZodEnum<{
|
|
189
|
-
|
|
189
|
+
webp: "webp";
|
|
190
190
|
jpg: "jpg";
|
|
191
|
+
jpeg: "jpeg";
|
|
191
192
|
png: "png";
|
|
192
|
-
webp: "webp";
|
|
193
193
|
}>>;
|
|
194
194
|
}, z.core.$strict>>;
|
|
195
195
|
name: z.ZodString;
|
|
@@ -248,10 +248,10 @@ declare const richTextFieldConfigSchema: z.ZodIntersection<z.ZodDiscriminatedUni
|
|
|
248
248
|
*/
|
|
249
249
|
omitExtension: z.ZodOptional<z.ZodBoolean>;
|
|
250
250
|
format: z.ZodOptional<z.ZodEnum<{
|
|
251
|
-
|
|
251
|
+
webp: "webp";
|
|
252
252
|
jpg: "jpg";
|
|
253
|
+
jpeg: "jpeg";
|
|
253
254
|
png: "png";
|
|
254
|
-
webp: "webp";
|
|
255
255
|
}>>;
|
|
256
256
|
}, z.core.$strict>>;
|
|
257
257
|
name: z.ZodString;
|
|
@@ -346,8 +346,8 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
346
346
|
}, z.core.$strict>]>, z.ZodObject<{
|
|
347
347
|
type: z.ZodLiteral<"select">;
|
|
348
348
|
optionsType: z.ZodEnum<{
|
|
349
|
-
section: "section";
|
|
350
349
|
db: "db";
|
|
350
|
+
section: "section";
|
|
351
351
|
static: "static";
|
|
352
352
|
}>;
|
|
353
353
|
build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<SelectField, SelectField>>;
|
|
@@ -118,6 +118,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
118
118
|
allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
|
|
119
119
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
120
120
|
name: z.ZodString;
|
|
121
|
+
order: z.ZodNumber;
|
|
122
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
121
123
|
db: z.ZodObject<{
|
|
122
124
|
table: z.ZodString;
|
|
123
125
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -141,8 +143,6 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
141
143
|
name: z.ZodOptional<z.ZodString>;
|
|
142
144
|
}, z.core.$strict>>>;
|
|
143
145
|
}, z.core.$strict>;
|
|
144
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
145
|
-
order: z.ZodNumber;
|
|
146
146
|
icon: z.ZodOptional<z.ZodString>;
|
|
147
147
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
148
148
|
db: z.ZodObject<{
|
|
@@ -215,6 +215,8 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
215
215
|
*/
|
|
216
216
|
allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
|
|
217
217
|
name: z.ZodString;
|
|
218
|
+
order: z.ZodNumber;
|
|
219
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
218
220
|
db: z.ZodObject<{
|
|
219
221
|
table: z.ZodString;
|
|
220
222
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -238,8 +240,6 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
238
240
|
name: z.ZodOptional<z.ZodString>;
|
|
239
241
|
}, z.core.$strict>>>;
|
|
240
242
|
}, z.core.$strict>;
|
|
241
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
242
|
-
order: z.ZodNumber;
|
|
243
243
|
icon: z.ZodOptional<z.ZodString>;
|
|
244
244
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
245
245
|
db: z.ZodObject<{
|