nextjs-cms 0.9.19 → 0.9.21
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 +8 -48
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/lib/serverActions.d.ts +9 -49
- package/dist/api/lib/serverActions.d.ts.map +1 -1
- package/dist/api/lib/serverActions.js +85 -37
- package/dist/api/root.d.ts +16 -96
- package/dist/api/root.d.ts.map +1 -1
- package/dist/api/routers/gallery.d.ts +1 -0
- package/dist/api/routers/gallery.d.ts.map +1 -1
- package/dist/api/routers/gallery.js +36 -8
- package/dist/api/routers/hasItemsSection.d.ts +3 -30
- package/dist/api/routers/hasItemsSection.d.ts.map +1 -1
- package/dist/api/routers/navigation.d.ts +3 -3
- package/dist/api/routers/simpleSection.d.ts +1 -15
- package/dist/api/routers/simpleSection.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.js +606 -198
- package/dist/core/factories/FieldFactory.d.ts +1 -1
- package/dist/core/factories/FieldFactory.d.ts.map +1 -1
- package/dist/core/factories/FieldFactory.js +11 -9
- package/dist/core/fields/date-range.d.ts +4 -4
- package/dist/core/fields/date.d.ts.map +1 -1
- package/dist/core/fields/date.js +10 -6
- package/dist/core/fields/select.d.ts +23 -11
- package/dist/core/fields/select.d.ts.map +1 -1
- package/dist/core/fields/select.js +9 -5
- package/dist/core/fields/selectMultiple.d.ts +12 -4
- package/dist/core/fields/selectMultiple.d.ts.map +1 -1
- package/dist/core/fields/selectMultiple.js +10 -6
- package/dist/core/sections/category.d.ts +8 -6
- package/dist/core/sections/category.d.ts.map +1 -1
- package/dist/core/sections/hasItems.d.ts +8 -6
- package/dist/core/sections/hasItems.d.ts.map +1 -1
- package/dist/core/sections/section.d.ts +46 -25
- package/dist/core/sections/section.d.ts.map +1 -1
- package/dist/core/sections/section.js +18 -3
- package/dist/core/sections/simple.d.ts +6 -4
- package/dist/core/sections/simple.d.ts.map +1 -1
- package/dist/core/submit/ItemEditSubmit.d.ts.map +1 -1
- package/dist/core/submit/ItemEditSubmit.js +7 -1
- package/dist/core/submit/LocaleSubmit.d.ts +3 -3
- package/dist/core/submit/LocaleSubmit.d.ts.map +1 -1
- package/dist/core/submit/LocaleSubmit.js +9 -6
- package/dist/core/submit/submit.d.ts +4 -4
- package/dist/core/submit/submit.d.ts.map +1 -1
- package/dist/core/submit/submit.js +13 -9
- package/dist/core/types/index.d.ts +2 -2
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/db/cms-system-tables.d.ts.map +1 -1
- package/dist/db/cms-system-tables.js +2 -1
- package/dist/db/schema.d.ts +61 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +8 -0
- package/package.json +3 -3
package/dist/api/root.d.ts.map
CHANGED
|
@@ -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;AAgB5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA8FvB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAwBkgR,CAAC
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/api/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAgB5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA8FvB,eAAO,MAAM,S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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GADngZ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../../src/api/routers/gallery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../../src/api/routers/gallery.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAUxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FxB,CAAA"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { privateProcedure, router } from '../trpc.js';
|
|
2
|
-
import * as z from 'zod';
|
|
3
1
|
import fs from 'fs';
|
|
4
2
|
import path from 'path';
|
|
5
|
-
import { SectionFactory } from '../../core/factories/index.js';
|
|
6
3
|
import { TRPCError } from '@trpc/server';
|
|
7
|
-
import getString from '../../translations/index.js';
|
|
8
|
-
import { db } from '../../db/client.js';
|
|
9
4
|
import { sql } from 'drizzle-orm';
|
|
10
|
-
import
|
|
5
|
+
import * as z from 'zod';
|
|
11
6
|
import { getCMSConfig } from '../../core/config/index.js';
|
|
7
|
+
import { MysqlTableChecker } from '../../core/db/index.js';
|
|
8
|
+
import { SectionFactory } from '../../core/factories/index.js';
|
|
9
|
+
import { resolveLocale } from '../../core/localization/index.js';
|
|
10
|
+
import { db } from '../../db/client.js';
|
|
11
|
+
import getString from '../../translations/index.js';
|
|
12
|
+
import { privateProcedure, router } from '../trpc.js';
|
|
12
13
|
export const galleryRouter = router({
|
|
13
14
|
deletePhoto: privateProcedure
|
|
14
15
|
.input(z.object({
|
|
15
16
|
sectionName: z.string(),
|
|
16
17
|
photoName: z.string(),
|
|
17
18
|
referenceId: z.string(),
|
|
19
|
+
locale: z.string().optional(),
|
|
18
20
|
}))
|
|
19
21
|
.mutation(async ({ ctx, input }) => {
|
|
20
|
-
const
|
|
22
|
+
const cmsConfig = await getCMSConfig();
|
|
23
|
+
const uploadsFolder = cmsConfig.media.upload.path;
|
|
21
24
|
/**
|
|
22
25
|
* Get the section information
|
|
23
26
|
*/
|
|
@@ -43,7 +46,32 @@ export const galleryRouter = router({
|
|
|
43
46
|
const columns = await MysqlTableChecker.getColumns(gallery.db.tableName);
|
|
44
47
|
if (columns.includes(gallery.db.photoNameField) &&
|
|
45
48
|
columns.includes(gallery.db.referenceIdentifierField)) {
|
|
46
|
-
|
|
49
|
+
const galleryIsLocalized = gallery.localized === true && cmsConfig.localization?.enabled === true;
|
|
50
|
+
if (galleryIsLocalized) {
|
|
51
|
+
const localeResult = resolveLocale({
|
|
52
|
+
localization: cmsConfig.localization,
|
|
53
|
+
locale: input.locale,
|
|
54
|
+
});
|
|
55
|
+
if (!input.locale || !localeResult.resolvedLocale) {
|
|
56
|
+
throw new TRPCError({
|
|
57
|
+
code: 'BAD_REQUEST',
|
|
58
|
+
message: getString('invalidLocale', ctx.session.user.language, {
|
|
59
|
+
locale: input.locale ?? '',
|
|
60
|
+
locales: localeResult.availableLocales.map((l) => l.code).join(', '),
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (!columns.includes('locale')) {
|
|
65
|
+
throw new TRPCError({
|
|
66
|
+
code: 'BAD_REQUEST',
|
|
67
|
+
message: getString('galleryTableNotSetUp', ctx.session.user.language),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
await db.execute(sql `DELETE FROM ${sql.raw(gallery.db.tableName)} WHERE ${sql.raw(gallery.db.photoNameField)} = ${input.photoName} AND ${sql.raw(gallery.db.referenceIdentifierField)} = ${input.referenceId} AND \`locale\` = ${localeResult.resolvedLocale.code}`);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
await db.execute(sql `DELETE FROM ${sql.raw(gallery.db.tableName)} WHERE ${sql.raw(gallery.db.photoNameField)} = ${input.photoName} AND ${sql.raw(gallery.db.referenceIdentifierField)} = ${input.referenceId}`);
|
|
74
|
+
}
|
|
47
75
|
}
|
|
48
76
|
}
|
|
49
77
|
/**
|
|
@@ -72,21 +72,7 @@ export declare const hasItemsSectionRouter: import("@trpc/server").TRPCBuiltRout
|
|
|
72
72
|
singular: string;
|
|
73
73
|
plural: string;
|
|
74
74
|
};
|
|
75
|
-
gallery:
|
|
76
|
-
db: {
|
|
77
|
-
tableName: string;
|
|
78
|
-
referenceIdentifierField: string;
|
|
79
|
-
photoNameField: string;
|
|
80
|
-
metaField: string;
|
|
81
|
-
};
|
|
82
|
-
watermark?: boolean;
|
|
83
|
-
thumbnail?: {
|
|
84
|
-
width: number;
|
|
85
|
-
height: number;
|
|
86
|
-
fit: "cover" | "contain";
|
|
87
|
-
quality: number;
|
|
88
|
-
};
|
|
89
|
-
} | undefined;
|
|
75
|
+
gallery: import("../../index.js").SectionGallery | undefined;
|
|
90
76
|
variants: import("../../core/types/index.js").Variant[] | undefined;
|
|
91
77
|
configFile: string;
|
|
92
78
|
};
|
|
@@ -129,21 +115,7 @@ export declare const hasItemsSectionRouter: import("@trpc/server").TRPCBuiltRout
|
|
|
129
115
|
singular: string;
|
|
130
116
|
plural: string;
|
|
131
117
|
};
|
|
132
|
-
gallery:
|
|
133
|
-
db: {
|
|
134
|
-
tableName: string;
|
|
135
|
-
referenceIdentifierField: string;
|
|
136
|
-
photoNameField: string;
|
|
137
|
-
metaField: string;
|
|
138
|
-
};
|
|
139
|
-
watermark?: boolean;
|
|
140
|
-
thumbnail?: {
|
|
141
|
-
width: number;
|
|
142
|
-
height: number;
|
|
143
|
-
fit: "cover" | "contain";
|
|
144
|
-
quality: number;
|
|
145
|
-
};
|
|
146
|
-
} | undefined;
|
|
118
|
+
gallery: import("../../index.js").SectionGallery | undefined;
|
|
147
119
|
variants: import("../../core/types/index.js").Variant[] | undefined;
|
|
148
120
|
configFile: string;
|
|
149
121
|
};
|
|
@@ -167,6 +139,7 @@ export declare const hasItemsSectionRouter: import("@trpc/server").TRPCBuiltRout
|
|
|
167
139
|
referenceId: string;
|
|
168
140
|
photo: string;
|
|
169
141
|
meta: any;
|
|
142
|
+
locale?: string;
|
|
170
143
|
}[];
|
|
171
144
|
localization: {
|
|
172
145
|
defaultLocale: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasItemsSection.d.ts","sourceRoot":"","sources":["../../../src/api/routers/hasItemsSection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAcxB,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"hasItemsSection.d.ts","sourceRoot":"","sources":["../../../src/api/routers/hasItemsSection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAcxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAwG+53C,CAAC;;;;;uBAAyE,CAAC;;;;;;uBAA8G,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GADzn4C,CAAA"}
|