@open-mercato/core 0.6.6-develop.6339.1.193c6c7c71 → 0.6.6-develop.6344.1.c4b17c07c4

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 (32) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/catalog/components/products/ProductComplianceSection.js +1 -1
  3. package/dist/modules/catalog/components/products/ProductComplianceSection.js.map +2 -2
  4. package/dist/modules/catalog/data/validators.js +1 -1
  5. package/dist/modules/catalog/data/validators.js.map +2 -2
  6. package/dist/modules/communication_channels/backend/communication_channels/channels/[id]/page.js +1 -1
  7. package/dist/modules/communication_channels/backend/communication_channels/channels/[id]/page.js.map +2 -2
  8. package/dist/modules/communication_channels/lib/route-mutation-guard.js +19 -29
  9. package/dist/modules/communication_channels/lib/route-mutation-guard.js.map +2 -2
  10. package/dist/modules/customers/backend/customers/deals/pipeline/page.js +4 -4
  11. package/dist/modules/customers/backend/customers/deals/pipeline/page.js.map +2 -2
  12. package/dist/modules/customers/components/calendar/CalendarScreen.js +1 -1
  13. package/dist/modules/customers/components/calendar/CalendarScreen.js.map +2 -2
  14. package/dist/modules/integrations/api/[id]/credentials/route.js +14 -4
  15. package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
  16. package/dist/modules/integrations/lib/credentials-masking.js +50 -0
  17. package/dist/modules/integrations/lib/credentials-masking.js.map +7 -0
  18. package/dist/modules/notifications/lib/routeHelpers.js +18 -25
  19. package/dist/modules/notifications/lib/routeHelpers.js.map +2 -2
  20. package/dist/modules/payment_gateways/backend/payment-gateways/page.js +1 -1
  21. package/dist/modules/payment_gateways/backend/payment-gateways/page.js.map +2 -2
  22. package/package.json +7 -7
  23. package/src/modules/catalog/components/products/ProductComplianceSection.tsx +1 -1
  24. package/src/modules/catalog/data/validators.ts +1 -1
  25. package/src/modules/communication_channels/backend/communication_channels/channels/[id]/page.tsx +1 -1
  26. package/src/modules/communication_channels/lib/route-mutation-guard.ts +32 -32
  27. package/src/modules/customers/backend/customers/deals/pipeline/page.tsx +4 -4
  28. package/src/modules/customers/components/calendar/CalendarScreen.tsx +1 -1
  29. package/src/modules/integrations/api/[id]/credentials/route.ts +18 -4
  30. package/src/modules/integrations/lib/credentials-masking.ts +95 -0
  31. package/src/modules/notifications/lib/routeHelpers.ts +18 -26
  32. package/src/modules/payment_gateways/backend/payment-gateways/page.tsx +1 -1
@@ -2,10 +2,7 @@ import { z } from 'zod'
2
2
  import type { AwilixContainer } from 'awilix'
3
3
  import { resolveRequestContext } from '@open-mercato/shared/lib/api/context'
4
4
  import { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
5
- import {
6
- runCrudMutationGuardAfterSuccess,
7
- validateCrudMutationGuard,
8
- } from '@open-mercato/shared/lib/crud/mutation-guard'
5
+ import { runRouteMutationGuards } from '@open-mercato/shared/lib/crud/route-mutation-guard'
9
6
  import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
10
7
  import { resolveNotificationService, type NotificationService } from './notificationService'
11
8
 
@@ -106,33 +103,28 @@ export async function runGuardedNotificationWrite<T>(
106
103
  options: NotificationMutationGuardOptions,
107
104
  write: () => Promise<T>,
108
105
  ): Promise<GuardedNotificationWriteResult<T>> {
109
- const guardScope = {
110
- tenantId: scope.tenantId,
111
- organizationId: scope.organizationId,
112
- userId: scope.userId ?? '',
113
- resourceKind: options.resourceKind,
114
- resourceId: options.resourceId ?? '',
115
- operation: options.operation,
116
- requestMethod: req.method,
117
- requestHeaders: req.headers,
118
- }
119
-
120
- const guardResult = await validateCrudMutationGuard(container, {
121
- ...guardScope,
122
- mutationPayload: options.payload ?? null,
106
+ const guarded = await runRouteMutationGuards({
107
+ container,
108
+ req,
109
+ auth: {
110
+ userId: scope.userId ?? '',
111
+ tenantId: scope.tenantId,
112
+ organizationId: scope.organizationId,
113
+ },
114
+ input: {
115
+ resourceKind: options.resourceKind,
116
+ resourceId: options.resourceId ?? null,
117
+ operation: options.operation,
118
+ mutationPayload: options.payload ?? null,
119
+ },
123
120
  })
124
- if (guardResult && !guardResult.ok) {
125
- return { ok: false, response: Response.json(guardResult.body, { status: guardResult.status }) }
121
+ if (!guarded.ok) {
122
+ return { ok: false, response: guarded.response }
126
123
  }
127
124
 
128
125
  const result = await write()
129
126
 
130
- if (guardResult?.ok && guardResult.shouldRunAfterSuccess) {
131
- await runCrudMutationGuardAfterSuccess(container, {
132
- ...guardScope,
133
- metadata: guardResult.metadata ?? null,
134
- })
135
- }
127
+ await guarded.runAfterSuccess()
136
128
 
137
129
  return { ok: true, result }
138
130
  }
@@ -354,7 +354,7 @@ export default function PaymentTransactionsPage() {
354
354
  }, [loadDetail, loadRows, runMutation, selectedId, t])
355
355
 
356
356
  const providerOptions = React.useMemo(() => {
357
- const values = Array.from(new Set(rows.map((row) => row.providerKey).filter(Boolean))).sort()
357
+ const values = Array.from(new Set(rows.map((row) => row.providerKey).filter(Boolean))).sort((a, b) => a.localeCompare(b))
358
358
  return values.map((value) => ({
359
359
  label: formatTypeLabel(value),
360
360
  value,