nextjs-cms 0.5.89 → 0.5.91
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 +57 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/lib/serverActions.d.ts +2 -1
- package/dist/api/lib/serverActions.d.ts.map +1 -1
- package/dist/api/lib/serverActions.js +49 -15
- package/dist/api/root.d.ts +114 -0
- package/dist/api/root.d.ts.map +1 -1
- package/dist/api/root.js +2 -0
- package/dist/api/routers/accountSettings.d.ts.map +1 -1
- package/dist/api/routers/accountSettings.js +65 -3
- package/dist/api/routers/admins.d.ts.map +1 -1
- package/dist/api/routers/admins.js +54 -2
- package/dist/api/routers/auth.d.ts.map +1 -1
- package/dist/api/routers/auth.js +27 -2
- package/dist/api/routers/categorySection.d.ts.map +1 -1
- package/dist/api/routers/categorySection.js +3 -1
- package/dist/api/routers/hasItemsSection.d.ts.map +1 -1
- package/dist/api/routers/hasItemsSection.js +3 -1
- package/dist/api/routers/logs.d.ts +59 -0
- package/dist/api/routers/logs.d.ts.map +1 -0
- package/dist/api/routers/logs.js +75 -0
- package/dist/core/factories/FieldFactory.d.ts.map +1 -1
- package/dist/core/factories/FieldFactory.js +16 -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 +6 -6
- package/dist/core/sections/hasItems.d.ts +12 -12
- package/dist/core/sections/section.d.ts +3 -3
- package/dist/core/sections/simple.d.ts +4 -4
- package/dist/core/submit/ItemEditSubmit.d.ts +7 -0
- package/dist/core/submit/ItemEditSubmit.d.ts.map +1 -1
- package/dist/core/submit/ItemEditSubmit.js +32 -0
- package/dist/core/submit/NewItemSubmit.d.ts +2 -0
- package/dist/core/submit/NewItemSubmit.d.ts.map +1 -1
- package/dist/core/submit/NewItemSubmit.js +3 -0
- package/dist/core/submit/submit.d.ts +8 -4
- package/dist/core/submit/submit.d.ts.map +1 -1
- package/dist/core/submit/submit.js +58 -8
- package/dist/db/schema.d.ts +231 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/logging/audit.d.ts +20 -0
- package/dist/logging/audit.d.ts.map +1 -0
- package/dist/logging/audit.js +48 -0
- package/dist/logging/index.d.ts +2 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +1 -0
- package/dist/logging/log.d.ts +20 -0
- package/dist/logging/log.d.ts.map +1 -0
- package/dist/logging/log.js +48 -0
- package/dist/translations/dictionaries/ar.json +6 -0
- package/dist/translations/dictionaries/en.json +6 -0
- package/package.json +7 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { privateProcedure, router } from '../trpc.js';
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
import { deleteSectionItem, getCategorySection, getCategorySectionChildren } from '../lib/serverActions.js';
|
|
4
|
+
import { getRequestMetadataFromHeaders } from '../../logging/index.js';
|
|
4
5
|
export const categorySectionRouter = router({
|
|
5
6
|
get: privateProcedure
|
|
6
7
|
.input(z.object({
|
|
@@ -33,6 +34,7 @@ export const categorySectionRouter = router({
|
|
|
33
34
|
deleteChildren: z.boolean().optional(),
|
|
34
35
|
}))
|
|
35
36
|
.mutation(async ({ ctx, input }) => {
|
|
36
|
-
|
|
37
|
+
const requestMetadata = getRequestMetadataFromHeaders(ctx.headers);
|
|
38
|
+
return await deleteSectionItem(ctx.session, input.sectionName, input.sectionItemId, input.deleteChildren, requestMetadata);
|
|
37
39
|
}),
|
|
38
40
|
});
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"hasItemsSection.d.ts","sourceRoot":"","sources":["../../../src/api/routers/hasItemsSection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsChC,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { privateProcedure, router } from '../trpc.js';
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
import { createEditPage, createNewPage, deleteSectionItem, getBrowsePage } from '../lib/serverActions.js';
|
|
4
|
+
import { getRequestMetadataFromHeaders } from '../../logging/index.js';
|
|
4
5
|
export const hasItemsSectionRouter = router({
|
|
5
6
|
listItems: privateProcedure
|
|
6
7
|
.input(z.object({
|
|
@@ -29,6 +30,7 @@ export const hasItemsSectionRouter = router({
|
|
|
29
30
|
deleteItem: privateProcedure
|
|
30
31
|
.input(z.object({ sectionName: z.string(), sectionItemId: z.number().or(z.string()) }))
|
|
31
32
|
.mutation(async ({ ctx, input }) => {
|
|
32
|
-
|
|
33
|
+
const requestMetadata = getRequestMetadataFromHeaders(ctx.headers);
|
|
34
|
+
return await deleteSectionItem(ctx.session, input.sectionName, input.sectionItemId, undefined, requestMetadata);
|
|
33
35
|
}),
|
|
34
36
|
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const logsRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
3
|
+
ctx: {
|
|
4
|
+
headers: Headers;
|
|
5
|
+
db: import("drizzle-orm/mysql2").MySql2Database<typeof import("../../db/schema.js")> & {
|
|
6
|
+
$client: import("mysql2/promise").Pool;
|
|
7
|
+
};
|
|
8
|
+
session: import("../../index.js").Session | null;
|
|
9
|
+
};
|
|
10
|
+
meta: object;
|
|
11
|
+
errorShape: {
|
|
12
|
+
data: {
|
|
13
|
+
zodError: z.core.$ZodFlattenedError<unknown, string> | null;
|
|
14
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
15
|
+
httpStatus: number;
|
|
16
|
+
path?: string;
|
|
17
|
+
stack?: string;
|
|
18
|
+
};
|
|
19
|
+
message: string;
|
|
20
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
21
|
+
};
|
|
22
|
+
transformer: true;
|
|
23
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
24
|
+
list: import("@trpc/server").TRPCQueryProcedure<{
|
|
25
|
+
input: {
|
|
26
|
+
limit?: number | undefined;
|
|
27
|
+
offset?: number | undefined;
|
|
28
|
+
eventType?: string | undefined;
|
|
29
|
+
actorId?: string | undefined;
|
|
30
|
+
sectionName?: string | undefined;
|
|
31
|
+
entityType?: string | undefined;
|
|
32
|
+
entityId?: string | undefined;
|
|
33
|
+
from?: string | undefined;
|
|
34
|
+
to?: string | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
output: {
|
|
37
|
+
items: {
|
|
38
|
+
id: number;
|
|
39
|
+
eventType: string;
|
|
40
|
+
actorId: string | null;
|
|
41
|
+
actorUsername: string | null;
|
|
42
|
+
entityType: string | null;
|
|
43
|
+
entityId: string | null;
|
|
44
|
+
entityLabel: string | null;
|
|
45
|
+
sectionName: string | null;
|
|
46
|
+
metadata: string | null;
|
|
47
|
+
ipAddress: string | null;
|
|
48
|
+
userAgent: string | null;
|
|
49
|
+
source: string | null;
|
|
50
|
+
createdAt: Date;
|
|
51
|
+
}[];
|
|
52
|
+
total: number;
|
|
53
|
+
limit: number;
|
|
54
|
+
offset: number;
|
|
55
|
+
};
|
|
56
|
+
meta: object;
|
|
57
|
+
}>;
|
|
58
|
+
}>>;
|
|
59
|
+
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/api/routers/logs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAoBxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DrB,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { TRPCError } from '@trpc/server';
|
|
2
|
+
import { and, desc, eq, gte, lte, sql } from 'drizzle-orm';
|
|
3
|
+
import * as z from 'zod';
|
|
4
|
+
import { db } from '../../db/client.js';
|
|
5
|
+
import { LogsTable } from '../../db/schema.js';
|
|
6
|
+
import { isAccessAllowed } from '../lib/serverActions.js';
|
|
7
|
+
import { privateProcedure, router } from '../trpc.js';
|
|
8
|
+
const listInputSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
limit: z.number().min(1).max(200).optional(),
|
|
11
|
+
offset: z.number().min(0).optional(),
|
|
12
|
+
eventType: z.string().optional(),
|
|
13
|
+
actorId: z.string().optional(),
|
|
14
|
+
sectionName: z.string().optional(),
|
|
15
|
+
entityType: z.string().optional(),
|
|
16
|
+
entityId: z.string().optional(),
|
|
17
|
+
from: z.string().datetime().optional(),
|
|
18
|
+
to: z.string().datetime().optional(),
|
|
19
|
+
})
|
|
20
|
+
.optional();
|
|
21
|
+
export const logsRouter = router({
|
|
22
|
+
list: privateProcedure.input(listInputSchema).query(async ({ ctx, input }) => {
|
|
23
|
+
const accessAllowed = await isAccessAllowed({
|
|
24
|
+
sectionName: 'log',
|
|
25
|
+
userId: ctx.session.user.id,
|
|
26
|
+
});
|
|
27
|
+
if (!accessAllowed) {
|
|
28
|
+
throw new TRPCError({
|
|
29
|
+
code: 'NOT_FOUND',
|
|
30
|
+
message: 'Section not found or you do not have access to this operation',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const limit = input?.limit ?? 50;
|
|
34
|
+
const offset = input?.offset ?? 0;
|
|
35
|
+
const conditions = [];
|
|
36
|
+
if (input?.eventType) {
|
|
37
|
+
conditions.push(eq(LogsTable.eventType, input.eventType));
|
|
38
|
+
}
|
|
39
|
+
if (input?.actorId) {
|
|
40
|
+
conditions.push(eq(LogsTable.actorId, input.actorId));
|
|
41
|
+
}
|
|
42
|
+
if (input?.sectionName) {
|
|
43
|
+
conditions.push(eq(LogsTable.sectionName, input.sectionName));
|
|
44
|
+
}
|
|
45
|
+
if (input?.entityType) {
|
|
46
|
+
conditions.push(eq(LogsTable.entityType, input.entityType));
|
|
47
|
+
}
|
|
48
|
+
if (input?.entityId) {
|
|
49
|
+
conditions.push(eq(LogsTable.entityId, input.entityId));
|
|
50
|
+
}
|
|
51
|
+
if (input?.from) {
|
|
52
|
+
conditions.push(gte(LogsTable.createdAt, new Date(input.from)));
|
|
53
|
+
}
|
|
54
|
+
if (input?.to) {
|
|
55
|
+
conditions.push(lte(LogsTable.createdAt, new Date(input.to)));
|
|
56
|
+
}
|
|
57
|
+
const whereClause = conditions.length > 0 ? and(...conditions) : undefined;
|
|
58
|
+
let listQuery = db.select().from(LogsTable).$dynamic();
|
|
59
|
+
let countQuery = db.select({ count: sql `count(*)` }).from(LogsTable).$dynamic();
|
|
60
|
+
if (whereClause) {
|
|
61
|
+
listQuery = listQuery.where(whereClause);
|
|
62
|
+
countQuery = countQuery.where(whereClause);
|
|
63
|
+
}
|
|
64
|
+
const [rows, totalRows] = await Promise.all([
|
|
65
|
+
listQuery.orderBy(desc(LogsTable.createdAt)).limit(limit).offset(offset),
|
|
66
|
+
countQuery,
|
|
67
|
+
]);
|
|
68
|
+
return {
|
|
69
|
+
items: rows,
|
|
70
|
+
total: totalRows[0]?.count ?? 0,
|
|
71
|
+
limit,
|
|
72
|
+
offset,
|
|
73
|
+
};
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
@@ -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;AAIlD,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;
|
|
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;AAIlD,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"}
|
|
@@ -2,7 +2,7 @@ import { sql } from 'drizzle-orm';
|
|
|
2
2
|
import { db } from '../../db/client.js';
|
|
3
3
|
import { SectionFactory } from './SectionFactory.js';
|
|
4
4
|
import { SimpleSection, HasItemsSection, CategorySection } from '../sections/index.js';
|
|
5
|
-
import { checkboxField, SelectField, SelectMultipleField } from '../fields/index.js';
|
|
5
|
+
import { checkboxField, SelectField, SelectMultipleField, TagsField } from '../fields/index.js';
|
|
6
6
|
import { is } from '../helpers/index.js';
|
|
7
7
|
import { cloneDeep } from 'lodash-es';
|
|
8
8
|
import chalk from 'chalk';
|
|
@@ -96,6 +96,21 @@ export class FieldFactory {
|
|
|
96
96
|
}
|
|
97
97
|
this._values[field.name] = values;
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Handle TagsField with destinationDb
|
|
101
|
+
* Tags are raw string values stored directly in the destination table (no JOIN needed)
|
|
102
|
+
*/
|
|
103
|
+
if (field.destinationDb && is(field, TagsField)) {
|
|
104
|
+
const [_rows] = await db.execute(sql `SELECT ${sql.raw(field.destinationDb.selectIdentifier)} FROM ${sql.raw(field.destinationDb.table)} WHERE ${sql.raw(field.destinationDb.itemIdentifier)} = ${this.itemId}`);
|
|
105
|
+
const tags = [];
|
|
106
|
+
if (Array.isArray(_rows)) {
|
|
107
|
+
for (const row of _rows) {
|
|
108
|
+
tags.push(row[field.destinationDb.selectIdentifier]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Tags are stored as comma-separated string in the field value
|
|
112
|
+
this._values[field.name] = tags.join(',');
|
|
113
|
+
}
|
|
99
114
|
}
|
|
100
115
|
/**
|
|
101
116
|
* If the section item is not found, set the `_error` property to true
|
|
@@ -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
|
-
webp: "webp";
|
|
58
|
-
jpg: "jpg";
|
|
59
57
|
jpeg: "jpeg";
|
|
58
|
+
jpg: "jpg";
|
|
60
59
|
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
|
-
webp: "webp";
|
|
205
|
-
jpg: "jpg";
|
|
206
204
|
jpeg: "jpeg";
|
|
205
|
+
jpg: "jpg";
|
|
207
206
|
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
|
-
webp: "webp";
|
|
277
|
-
jpg: "jpg";
|
|
278
276
|
jpeg: "jpeg";
|
|
277
|
+
jpg: "jpg";
|
|
279
278
|
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
|
-
webp: "webp";
|
|
35
|
-
jpg: "jpg";
|
|
36
34
|
jpeg: "jpeg";
|
|
35
|
+
jpg: "jpg";
|
|
37
36
|
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
|
-
webp: "webp";
|
|
76
|
-
jpg: "jpg";
|
|
77
75
|
jpeg: "jpeg";
|
|
76
|
+
jpg: "jpg";
|
|
78
77
|
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?: "jpeg" | "jpg" | "png" | "webp" | 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
|
-
webp: "webp";
|
|
190
|
-
jpg: "jpg";
|
|
191
189
|
jpeg: "jpeg";
|
|
190
|
+
jpg: "jpg";
|
|
192
191
|
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
|
-
webp: "webp";
|
|
252
|
-
jpg: "jpg";
|
|
253
251
|
jpeg: "jpeg";
|
|
252
|
+
jpg: "jpg";
|
|
254
253
|
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
|
-
db: "db";
|
|
350
349
|
section: "section";
|
|
350
|
+
db: "db";
|
|
351
351
|
static: "static";
|
|
352
352
|
}>;
|
|
353
353
|
build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<SelectField, SelectField>>;
|
|
@@ -117,10 +117,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
117
117
|
*/
|
|
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
|
-
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
121
120
|
name: z.ZodString;
|
|
122
|
-
order: z.ZodNumber;
|
|
123
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
124
121
|
db: z.ZodObject<{
|
|
125
122
|
table: z.ZodString;
|
|
126
123
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -144,6 +141,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
144
141
|
name: z.ZodOptional<z.ZodString>;
|
|
145
142
|
}, z.core.$strict>>>;
|
|
146
143
|
}, z.core.$strict>;
|
|
144
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
145
|
+
order: z.ZodNumber;
|
|
147
146
|
icon: z.ZodOptional<z.ZodString>;
|
|
148
147
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
149
148
|
db: z.ZodObject<{
|
|
@@ -160,6 +159,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
160
159
|
quality: z.ZodNumber;
|
|
161
160
|
}, z.core.$strict>>;
|
|
162
161
|
}, z.core.$strict>>;
|
|
162
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
163
163
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
164
164
|
}, z.core.$strict>;
|
|
165
165
|
export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
@@ -214,10 +214,7 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
214
214
|
* @default false
|
|
215
215
|
*/
|
|
216
216
|
allowRecursiveDelete: z.ZodOptional<z.ZodBoolean>;
|
|
217
|
-
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
218
217
|
name: z.ZodString;
|
|
219
|
-
order: z.ZodNumber;
|
|
220
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
221
218
|
db: z.ZodObject<{
|
|
222
219
|
table: z.ZodString;
|
|
223
220
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -241,6 +238,8 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
241
238
|
name: z.ZodOptional<z.ZodString>;
|
|
242
239
|
}, z.core.$strict>>>;
|
|
243
240
|
}, z.core.$strict>;
|
|
241
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
242
|
+
order: z.ZodNumber;
|
|
244
243
|
icon: z.ZodOptional<z.ZodString>;
|
|
245
244
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
246
245
|
db: z.ZodObject<{
|
|
@@ -257,6 +256,7 @@ export declare const categorySectionConfigSchema: z.ZodObject<{
|
|
|
257
256
|
quality: z.ZodNumber;
|
|
258
257
|
}, z.core.$strict>>;
|
|
259
258
|
}, z.core.$strict>>;
|
|
259
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
260
260
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
261
261
|
}, z.core.$strict>;
|
|
262
262
|
export type CategorySectionOptions = z.infer<typeof optionsSchema>;
|
|
@@ -134,7 +134,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
134
134
|
size: number;
|
|
135
135
|
unit: "kb" | "mb";
|
|
136
136
|
} | undefined;
|
|
137
|
-
fileType?: ("
|
|
137
|
+
fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
|
|
138
138
|
removeExtension?: boolean | undefined;
|
|
139
139
|
label?: string | undefined;
|
|
140
140
|
required?: boolean | undefined;
|
|
@@ -163,7 +163,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
163
163
|
size: number;
|
|
164
164
|
unit: "kb" | "mb";
|
|
165
165
|
} | undefined;
|
|
166
|
-
fileType?: ("
|
|
166
|
+
fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
|
|
167
167
|
removeExtension?: boolean | undefined;
|
|
168
168
|
label?: string | undefined;
|
|
169
169
|
required?: boolean | undefined;
|
|
@@ -328,7 +328,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
328
328
|
size: number;
|
|
329
329
|
unit: "kb" | "mb";
|
|
330
330
|
} | undefined;
|
|
331
|
-
fileType?: ("
|
|
331
|
+
fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
|
|
332
332
|
removeExtension?: boolean | undefined;
|
|
333
333
|
label?: string | undefined;
|
|
334
334
|
required?: boolean | undefined;
|
|
@@ -357,7 +357,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
357
357
|
size: number;
|
|
358
358
|
unit: "kb" | "mb";
|
|
359
359
|
} | undefined;
|
|
360
|
-
fileType?: ("
|
|
360
|
+
fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
|
|
361
361
|
removeExtension?: boolean | undefined;
|
|
362
362
|
label?: string | undefined;
|
|
363
363
|
required?: boolean | undefined;
|
|
@@ -368,10 +368,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
368
368
|
}>>;
|
|
369
369
|
generateQR: z.ZodOptional<z.ZodBoolean>;
|
|
370
370
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
371
|
-
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
372
371
|
name: z.ZodString;
|
|
373
|
-
order: z.ZodNumber;
|
|
374
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
375
372
|
db: z.ZodObject<{
|
|
376
373
|
table: z.ZodString;
|
|
377
374
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -395,6 +392,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
395
392
|
name: z.ZodOptional<z.ZodString>;
|
|
396
393
|
}, z.core.$strict>>>;
|
|
397
394
|
}, z.core.$strict>;
|
|
395
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
396
|
+
order: z.ZodNumber;
|
|
398
397
|
icon: z.ZodOptional<z.ZodString>;
|
|
399
398
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
400
399
|
db: z.ZodObject<{
|
|
@@ -411,6 +410,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
411
410
|
quality: z.ZodNumber;
|
|
412
411
|
}, z.core.$strict>>;
|
|
413
412
|
}, z.core.$strict>>;
|
|
413
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
414
414
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
415
415
|
}, z.core.$strict>;
|
|
416
416
|
declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
@@ -546,7 +546,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
546
546
|
size: number;
|
|
547
547
|
unit: "kb" | "mb";
|
|
548
548
|
} | undefined;
|
|
549
|
-
fileType?: ("
|
|
549
|
+
fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
|
|
550
550
|
removeExtension?: boolean | undefined;
|
|
551
551
|
label?: string | undefined;
|
|
552
552
|
required?: boolean | undefined;
|
|
@@ -575,7 +575,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
575
575
|
size: number;
|
|
576
576
|
unit: "kb" | "mb";
|
|
577
577
|
} | undefined;
|
|
578
|
-
fileType?: ("
|
|
578
|
+
fileType?: ("jpeg" | "jpg" | "png" | "webp")[] | undefined;
|
|
579
579
|
removeExtension?: boolean | undefined;
|
|
580
580
|
label?: string | undefined;
|
|
581
581
|
required?: boolean | undefined;
|
|
@@ -585,10 +585,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
585
585
|
adminGenerated?: boolean | "readonly" | undefined;
|
|
586
586
|
}>>;
|
|
587
587
|
generateQR: z.ZodOptional<z.ZodBoolean>;
|
|
588
|
-
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
589
588
|
name: z.ZodString;
|
|
590
|
-
order: z.ZodNumber;
|
|
591
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
592
589
|
db: z.ZodObject<{
|
|
593
590
|
table: z.ZodString;
|
|
594
591
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -612,6 +609,8 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
612
609
|
name: z.ZodOptional<z.ZodString>;
|
|
613
610
|
}, z.core.$strict>>>;
|
|
614
611
|
}, z.core.$strict>;
|
|
612
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
613
|
+
order: z.ZodNumber;
|
|
615
614
|
icon: z.ZodOptional<z.ZodString>;
|
|
616
615
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
617
616
|
db: z.ZodObject<{
|
|
@@ -628,6 +627,7 @@ declare const hasItemsSectionConfigSchema: z.ZodObject<{
|
|
|
628
627
|
quality: z.ZodNumber;
|
|
629
628
|
}, z.core.$strict>>;
|
|
630
629
|
}, z.core.$strict>>;
|
|
630
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
631
631
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
632
632
|
}, z.core.$strict>;
|
|
633
633
|
export type HasItemsSectionOptions = z.infer<typeof optionsSchema>;
|
|
@@ -62,10 +62,7 @@ export declare const baseSectionOptionsSchema: z.ZodObject<{
|
|
|
62
62
|
*/
|
|
63
63
|
export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
|
|
64
64
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
65
|
-
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<Variant, Variant>>>;
|
|
66
65
|
name: z.ZodString;
|
|
67
|
-
order: z.ZodNumber;
|
|
68
|
-
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
69
66
|
db: z.ZodObject<{
|
|
70
67
|
table: z.ZodString;
|
|
71
68
|
identifier: z.ZodOptional<z.ZodCustom<FieldConfig, FieldConfig>>;
|
|
@@ -89,6 +86,8 @@ export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
|
|
|
89
86
|
name: z.ZodOptional<z.ZodString>;
|
|
90
87
|
}, z.core.$strict>>>;
|
|
91
88
|
}, z.core.$strict>;
|
|
89
|
+
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
90
|
+
order: z.ZodNumber;
|
|
92
91
|
icon: z.ZodOptional<z.ZodString>;
|
|
93
92
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
94
93
|
db: z.ZodObject<{
|
|
@@ -105,6 +104,7 @@ export declare const baseHelperFunctionOptionsSchema: z.ZodObject<{
|
|
|
105
104
|
quality: z.ZodNumber;
|
|
106
105
|
}, z.core.$strict>>;
|
|
107
106
|
}, z.core.$strict>>;
|
|
107
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<Variant, Variant>>>;
|
|
108
108
|
hooks: z.ZodOptional<z.ZodCustom<Hooks, Hooks>>;
|
|
109
109
|
}, z.core.$strict>;
|
|
110
110
|
export declare function validateSectionConfig(config: BaseSectionOptions): void;
|
|
@@ -22,10 +22,9 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
22
22
|
table: z.ZodString;
|
|
23
23
|
}, z.core.$strict>;
|
|
24
24
|
fields: z.ZodUnion<[z.ZodArray<z.ZodCustom<FieldConfig, FieldConfig>>, z.ZodArray<z.ZodCustom<FieldGroupConfig, FieldGroupConfig>>]>;
|
|
25
|
-
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
26
25
|
name: z.ZodString;
|
|
27
|
-
order: z.ZodNumber;
|
|
28
26
|
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
27
|
+
order: z.ZodNumber;
|
|
29
28
|
icon: z.ZodOptional<z.ZodString>;
|
|
30
29
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
31
30
|
db: z.ZodObject<{
|
|
@@ -42,6 +41,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
42
41
|
quality: z.ZodNumber;
|
|
43
42
|
}, z.core.$strict>>;
|
|
44
43
|
}, z.core.$strict>>;
|
|
44
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
45
45
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
46
46
|
}, z.core.$strict>;
|
|
47
47
|
declare const simpleSectionConfigSchema: z.ZodObject<{
|
|
@@ -53,10 +53,9 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
|
|
|
53
53
|
db: z.ZodObject<{
|
|
54
54
|
table: z.ZodString;
|
|
55
55
|
}, z.core.$strict>;
|
|
56
|
-
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
57
56
|
name: z.ZodString;
|
|
58
|
-
order: z.ZodNumber;
|
|
59
57
|
readonly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
58
|
+
order: z.ZodNumber;
|
|
60
59
|
icon: z.ZodOptional<z.ZodString>;
|
|
61
60
|
gallery: z.ZodOptional<z.ZodObject<{
|
|
62
61
|
db: z.ZodObject<{
|
|
@@ -73,6 +72,7 @@ declare const simpleSectionConfigSchema: z.ZodObject<{
|
|
|
73
72
|
quality: z.ZodNumber;
|
|
74
73
|
}, z.core.$strict>>;
|
|
75
74
|
}, z.core.$strict>>;
|
|
75
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").Variant, import("../types/index.js").Variant>>>;
|
|
76
76
|
hooks: z.ZodOptional<z.ZodCustom<import("./section.js").Hooks, import("./section.js").Hooks>>;
|
|
77
77
|
}, z.core.$strict>;
|
|
78
78
|
export type SimpleSectionOptions = z.infer<typeof optionsSchema>;
|
|
@@ -3,17 +3,20 @@ import type { Field } from '../fields';
|
|
|
3
3
|
import { Submit } from './submit';
|
|
4
4
|
import { entityKind } from '../helpers';
|
|
5
5
|
import type { User } from '../../auth';
|
|
6
|
+
import type { LogEventType, RequestMetadata } from '../../logging/index.js';
|
|
6
7
|
type ConstructorType = {
|
|
7
8
|
itemId: string;
|
|
8
9
|
sectionName: string;
|
|
9
10
|
user: User;
|
|
10
11
|
postData: FormData;
|
|
11
12
|
preSubmit?: boolean;
|
|
13
|
+
requestMetadata?: RequestMetadata;
|
|
12
14
|
};
|
|
13
15
|
export declare class EditSubmit extends Submit {
|
|
14
16
|
static readonly [entityKind]: string;
|
|
15
17
|
protected readonly _itemId: string;
|
|
16
18
|
protected _values: Record<string, any>;
|
|
19
|
+
protected getLogEventType(): LogEventType;
|
|
17
20
|
/**
|
|
18
21
|
* Constructor
|
|
19
22
|
*/
|
|
@@ -25,6 +28,10 @@ export declare class EditSubmit extends Submit {
|
|
|
25
28
|
initialize(): Promise<void>;
|
|
26
29
|
submit(): Promise<true | undefined>;
|
|
27
30
|
private initializeFieldValues;
|
|
31
|
+
protected getExistingFieldValue(fieldName: string): unknown;
|
|
32
|
+
protected getChangedFields(): string[];
|
|
33
|
+
private valuesEqual;
|
|
34
|
+
private normalizeLogValue;
|
|
28
35
|
/**
|
|
29
36
|
* Gets the field values from the associated table declared in the section info
|
|
30
37
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemEditSubmit.d.ts","sourceRoot":"","sources":["../../../src/core/submit/ItemEditSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;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;
|
|
1
|
+
{"version":3,"file":"ItemEditSubmit.d.ts","sourceRoot":"","sources":["../../../src/core/submit/ItemEditSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;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;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAO3E,KAAK,eAAe,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,QAAQ,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,eAAe,CAAC,EAAE,eAAe,CAAA;CACpC,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;cAExB,eAAe,IAAI,YAAY;IAIlD;;OAEG;gBACS,MAAM,EAAE,eAAe;IAKnC;;;OAGG;IACmB,UAAU;IASV,MAAM;YAQd,qBAAqB;cAuBhB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;cAIjD,gBAAgB,IAAI,MAAM,EAAE;IAO/C,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;YACW,aAAa;YAQb,sBAAsB;IAoBpC;;;;;OAKG;cACsB,kBAAkB;IAI3C;;;;;OAKG;cACsB,cAAc;YAUzB,oBAAoB;IAoBlC;;;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"}
|
|
@@ -7,6 +7,9 @@ export class EditSubmit extends Submit {
|
|
|
7
7
|
static [entityKind] = 'EditSubmit';
|
|
8
8
|
_itemId;
|
|
9
9
|
_values = {};
|
|
10
|
+
getLogEventType() {
|
|
11
|
+
return 'section.item.update';
|
|
12
|
+
}
|
|
10
13
|
/**
|
|
11
14
|
* Constructor
|
|
12
15
|
*/
|
|
@@ -54,6 +57,35 @@ export class EditSubmit extends Submit {
|
|
|
54
57
|
return;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
60
|
+
getExistingFieldValue(fieldName) {
|
|
61
|
+
return this._values?.[fieldName];
|
|
62
|
+
}
|
|
63
|
+
getChangedFields() {
|
|
64
|
+
const fields = super.getChangedFields();
|
|
65
|
+
if (!this._values)
|
|
66
|
+
return fields;
|
|
67
|
+
return fields.filter((fieldName) => !this.valuesEqual(this._values[fieldName], this.sqlNamesAndValues[fieldName]));
|
|
68
|
+
}
|
|
69
|
+
valuesEqual(previousValue, nextValue) {
|
|
70
|
+
return this.normalizeLogValue(previousValue) === this.normalizeLogValue(nextValue);
|
|
71
|
+
}
|
|
72
|
+
normalizeLogValue(value) {
|
|
73
|
+
if (value === null || value === undefined)
|
|
74
|
+
return null;
|
|
75
|
+
if (value instanceof Date)
|
|
76
|
+
return value.toISOString();
|
|
77
|
+
if (Array.isArray(value))
|
|
78
|
+
return value.map((item) => String(item)).sort().join(',');
|
|
79
|
+
if (typeof value === 'object') {
|
|
80
|
+
try {
|
|
81
|
+
return JSON.stringify(value);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
return String(value);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return String(value);
|
|
88
|
+
}
|
|
57
89
|
/**
|
|
58
90
|
* Gets the field values from the associated table declared in the section info
|
|
59
91
|
* @private
|