@open-mercato/core 0.6.6-develop.6331.1.a33b8e99b7 → 0.6.6-develop.6335.1.66528bcc62
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/.turbo/turbo-build.log +1 -1
- package/AGENTS.md +17 -0
- package/dist/modules/auth/api/logout.js +2 -3
- package/dist/modules/auth/api/logout.js.map +2 -2
- package/dist/modules/auth/api/session/refresh.js +5 -6
- package/dist/modules/auth/api/session/refresh.js.map +2 -2
- package/dist/modules/auth/lib/requestRedirect.js +31 -3
- package/dist/modules/auth/lib/requestRedirect.js.map +2 -2
- package/dist/modules/messages/api/[id]/actions/[actionId]/route.js +3 -0
- package/dist/modules/messages/api/[id]/actions/[actionId]/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/archive/route.js +9 -2
- package/dist/modules/messages/api/[id]/archive/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +2 -0
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/api/openapi.js +3 -0
- package/dist/modules/messages/api/openapi.js.map +2 -2
- package/dist/modules/messages/commands/actions.js +4 -0
- package/dist/modules/messages/commands/actions.js.map +2 -2
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetails.js +1 -1
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetails.js.map +2 -2
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsActions.js +13 -1
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsActions.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/MessageHeader.js +1 -1
- package/dist/modules/messages/components/message-detail/panels/MessageHeader.js.map +2 -2
- package/dist/modules/messages/lib/actions.js +29 -2
- package/dist/modules/messages/lib/actions.js.map +2 -2
- package/dist/modules/sales/api/documents/factory.js +11 -1
- package/dist/modules/sales/api/documents/factory.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/auth/api/logout.ts +2 -3
- package/src/modules/auth/api/session/refresh.ts +5 -6
- package/src/modules/auth/lib/requestRedirect.ts +44 -2
- package/src/modules/messages/api/[id]/actions/[actionId]/route.ts +3 -0
- package/src/modules/messages/api/[id]/archive/route.ts +10 -2
- package/src/modules/messages/api/[id]/route.ts +2 -0
- package/src/modules/messages/api/openapi.ts +3 -0
- package/src/modules/messages/commands/actions.ts +8 -0
- package/src/modules/messages/components/message-detail/hooks/useMessageDetails.ts +1 -1
- package/src/modules/messages/components/message-detail/hooks/useMessageDetailsActions.ts +14 -1
- package/src/modules/messages/components/message-detail/panels/MessageHeader.tsx +1 -1
- package/src/modules/messages/components/message-detail/types.ts +2 -0
- package/src/modules/messages/i18n/de.json +1 -0
- package/src/modules/messages/i18n/en.json +1 -0
- package/src/modules/messages/i18n/es.json +1 -0
- package/src/modules/messages/i18n/pl.json +1 -0
- package/src/modules/messages/lib/actions.ts +30 -2
- package/src/modules/sales/api/documents/factory.ts +22 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parseDecryptedFieldValue } from '@open-mercato/shared/lib/encryption/tenantDataEncryptionService'
|
|
2
2
|
import { sanitizeRichTextHref } from '@open-mercato/shared/lib/html/sanitizeRichText'
|
|
3
3
|
import type { Message, MessageAction, MessageActionData, MessageObject } from '../data/entities'
|
|
4
|
-
import { getMessageObjectType } from './message-objects-registry'
|
|
5
|
-
import { getMessageType } from './message-types-registry'
|
|
4
|
+
import { getAllMessageObjectTypes, getMessageObjectType } from './message-objects-registry'
|
|
5
|
+
import { getAllMessageTypes, getMessageType } from './message-types-registry'
|
|
6
6
|
|
|
7
7
|
type MessageActionSource = 'message' | 'type_default' | 'object'
|
|
8
8
|
|
|
@@ -227,6 +227,34 @@ export function resolveActionHref(
|
|
|
227
227
|
return sanitizeRichTextHref(resolved)
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
function collectCommandId(target: Set<string>, commandId: unknown): void {
|
|
231
|
+
if (typeof commandId !== 'string') return
|
|
232
|
+
const trimmed = commandId.trim()
|
|
233
|
+
if (trimmed.length > 0) target.add(trimmed)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function getMessageSafeCommandIds(): Set<string> {
|
|
237
|
+
const safeCommandIds = new Set<string>()
|
|
238
|
+
for (const messageType of getAllMessageTypes()) {
|
|
239
|
+
for (const action of messageType.defaultActions ?? []) {
|
|
240
|
+
collectCommandId(safeCommandIds, action.commandId)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
for (const objectType of getAllMessageObjectTypes()) {
|
|
244
|
+
for (const action of objectType.actions ?? []) {
|
|
245
|
+
collectCommandId(safeCommandIds, action.commandId)
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return safeCommandIds
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function isMessageSafeCommandId(commandId: unknown): boolean {
|
|
252
|
+
if (typeof commandId !== 'string') return false
|
|
253
|
+
const trimmed = commandId.trim()
|
|
254
|
+
if (trimmed.length === 0) return false
|
|
255
|
+
return getMessageSafeCommandIds().has(trimmed)
|
|
256
|
+
}
|
|
257
|
+
|
|
230
258
|
export function resolveActionCommandInput(
|
|
231
259
|
action: ResolvedMessageAction,
|
|
232
260
|
message: Message,
|
|
@@ -344,6 +344,27 @@ export function buildDocumentCrudOptions(binding: DocumentBinding) {
|
|
|
344
344
|
...(binding.kind === 'order' ? orderOnlyFields : quoteOnlyFields),
|
|
345
345
|
]
|
|
346
346
|
|
|
347
|
+
// Large JSONB snapshot/payload columns that only the detail page renders. The
|
|
348
|
+
// grid never reads them, so selecting them for list pages fetches and decrypts
|
|
349
|
+
// blobs over the wire for nothing (#2233). `customer_snapshot` is intentionally
|
|
350
|
+
// kept because the grid derives the customer name/email column from it.
|
|
351
|
+
const detailOnlyProjectionFields = new Set([
|
|
352
|
+
'billing_address_snapshot',
|
|
353
|
+
'shipping_address_snapshot',
|
|
354
|
+
'shipping_method_snapshot',
|
|
355
|
+
'payment_method_snapshot',
|
|
356
|
+
'totals_snapshot',
|
|
357
|
+
'metadata',
|
|
358
|
+
])
|
|
359
|
+
|
|
360
|
+
const gridFields = listFields.filter((field) => !detailOnlyProjectionFields.has(field))
|
|
361
|
+
|
|
362
|
+
// The detail page fetches a single document through this same list route with an
|
|
363
|
+
// `?id=` filter (there is no separate detail endpoint), so it needs the full
|
|
364
|
+
// projection. Grid listings (no `id`) use the trimmed projection.
|
|
365
|
+
const resolveListFields = (query: ListQuery) =>
|
|
366
|
+
query && typeof query.id === 'string' && query.id.length ? listFields : gridFields
|
|
367
|
+
|
|
347
368
|
return {
|
|
348
369
|
metadata: routeMetadata,
|
|
349
370
|
orm: {
|
|
@@ -359,7 +380,7 @@ export function buildDocumentCrudOptions(binding: DocumentBinding) {
|
|
|
359
380
|
list: {
|
|
360
381
|
schema: listSchema,
|
|
361
382
|
entityId: binding.entityId,
|
|
362
|
-
fields:
|
|
383
|
+
fields: (query: ListQuery) => resolveListFields(query),
|
|
363
384
|
sortFieldMap: buildSortMap(numberColumn),
|
|
364
385
|
buildFilters: async (query: any) => buildFilters(query, numberColumn, binding.kind),
|
|
365
386
|
decorateCustomFields: { entityIds: [binding.entityId] },
|