@open-mercato/core 0.7.1-develop.7130.1.fef2396fd8 → 0.7.1-develop.7131.1.20abf9e885
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/modules/audit_logs/api/audit-logs/actions/redo/route.js +5 -0
- package/dist/modules/audit_logs/api/audit-logs/actions/redo/route.js.map +2 -2
- package/dist/modules/auth/api/profile/route.js +5 -0
- package/dist/modules/auth/api/profile/route.js.map +2 -2
- package/dist/modules/customers/api/activities/route.js +13 -0
- package/dist/modules/customers/api/activities/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/[kind]/[id]/route.js +9 -0
- package/dist/modules/customers/api/dictionaries/[kind]/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/[kind]/route.js +5 -0
- package/dist/modules/customers/api/dictionaries/[kind]/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/kind-settings/route.js +5 -0
- package/dist/modules/customers/api/dictionaries/kind-settings/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/cancel/route.js +5 -0
- package/dist/modules/customers/api/interactions/cancel/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/complete/route.js +5 -0
- package/dist/modules/customers/api/interactions/complete/route.js.map +2 -2
- package/dist/modules/customers/api/labels/assign/route.js +5 -0
- package/dist/modules/customers/api/labels/assign/route.js.map +2 -2
- package/dist/modules/customers/api/labels/route.js +5 -0
- package/dist/modules/customers/api/labels/route.js.map +2 -2
- package/dist/modules/customers/api/labels/unassign/route.js +5 -0
- package/dist/modules/customers/api/labels/unassign/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js +9 -0
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/route.js +5 -0
- package/dist/modules/customers/api/people/[id]/companies/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js +5 -0
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/route.js +13 -0
- package/dist/modules/customers/api/pipeline-stages/route.js.map +2 -2
- package/dist/modules/customers/api/pipelines/route.js +13 -0
- package/dist/modules/customers/api/pipelines/route.js.map +2 -2
- package/dist/modules/customers/api/settings/address-format/route.js +5 -0
- package/dist/modules/customers/api/settings/address-format/route.js.map +2 -2
- package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js +5 -0
- package/dist/modules/customers/api/settings/dictionary-sort-modes/route.js.map +2 -2
- package/dist/modules/customers/api/settings/stuck-threshold/route.js +5 -0
- package/dist/modules/customers/api/settings/stuck-threshold/route.js.map +2 -2
- package/dist/modules/customers/api/tags/assign/route.js +5 -0
- package/dist/modules/customers/api/tags/assign/route.js.map +2 -2
- package/dist/modules/customers/api/tags/unassign/route.js +5 -0
- package/dist/modules/customers/api/tags/unassign/route.js.map +2 -2
- package/dist/modules/customers/api/todos/route.js +13 -0
- package/dist/modules/customers/api/todos/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js +9 -0
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.js +5 -0
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js +5 -0
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.js +5 -0
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.js.map +2 -2
- package/dist/modules/directory/api/organization-branding/route.js +5 -0
- package/dist/modules/directory/api/organization-branding/route.js.map +2 -2
- package/dist/modules/eudr/api/plots/import/route.js.map +2 -2
- package/dist/modules/eudr/api/product-mappings/suggestions/apply/route.js.map +2 -2
- package/dist/modules/feature_toggles/api/overrides/route.js +5 -0
- package/dist/modules/feature_toggles/api/overrides/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/actions/[actionId]/route.js +5 -0
- package/dist/modules/messages/api/[id]/actions/[actionId]/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/conversation/archive/route.js +5 -0
- package/dist/modules/messages/api/[id]/conversation/archive/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/conversation/read/route.js +5 -0
- package/dist/modules/messages/api/[id]/conversation/read/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/conversation/route.js +5 -0
- package/dist/modules/messages/api/[id]/conversation/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/forward/route.js +5 -0
- package/dist/modules/messages/api/[id]/forward/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/reply/route.js +5 -0
- package/dist/modules/messages/api/[id]/reply/route.js.map +2 -2
- package/dist/modules/messages/api/[id]/route.js +9 -0
- package/dist/modules/messages/api/[id]/route.js.map +2 -2
- package/dist/modules/messages/api/token/[token]/route.js +5 -0
- package/dist/modules/messages/api/token/[token]/route.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/assign/route.js +5 -0
- package/dist/modules/resources/api/resources/tags/assign/route.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/unassign/route.js +5 -0
- package/dist/modules/resources/api/resources/tags/unassign/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/accept/route.js +5 -0
- package/dist/modules/sales/api/quotes/accept/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/convert/route.js +5 -0
- package/dist/modules/sales/api/quotes/convert/route.js.map +2 -2
- package/dist/modules/sales/api/settings/document-numbers/route.js +5 -0
- package/dist/modules/sales/api/settings/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/settings/order-editing/route.js +5 -0
- package/dist/modules/sales/api/settings/order-editing/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +5 -0
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +5 -0
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/self/route.js +5 -0
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +5 -0
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +5 -0
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +5 -0
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js +9 -0
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/ai/assess/route.js +5 -0
- package/dist/modules/warranty_claims/api/ai/assess/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/assign/route.js +5 -0
- package/dist/modules/warranty_claims/api/assign/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/credit-memo/route.js +5 -0
- package/dist/modules/warranty_claims/api/credit-memo/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/events/route.js +5 -0
- package/dist/modules/warranty_claims/api/events/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/portal/claims/[id]/submit/route.js +5 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/submit/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.js +5 -0
- package/dist/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/portal/claims/route.js +5 -0
- package/dist/modules/warranty_claims/api/portal/claims/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/portal/events/route.js +5 -0
- package/dist/modules/warranty_claims/api/portal/events/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/receiving/route.js +5 -0
- package/dist/modules/warranty_claims/api/receiving/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/replacement-order/route.js +5 -0
- package/dist/modules/warranty_claims/api/replacement-order/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/return-label/route.js +5 -0
- package/dist/modules/warranty_claims/api/return-label/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/sales-return/route.js +5 -0
- package/dist/modules/warranty_claims/api/sales-return/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/settings-general/route.js +5 -0
- package/dist/modules/warranty_claims/api/settings-general/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/submit/route.js +5 -0
- package/dist/modules/warranty_claims/api/submit/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/transition/route.js +5 -0
- package/dist/modules/warranty_claims/api/transition/route.js.map +2 -2
- package/dist/modules/warranty_claims/api/vendor-recovery/route.js +5 -0
- package/dist/modules/warranty_claims/api/vendor-recovery/route.js.map +2 -2
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js +5 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/audit_logs/api/audit-logs/actions/redo/route.ts +5 -0
- package/src/modules/auth/api/profile/route.ts +5 -0
- package/src/modules/customers/api/activities/route.ts +13 -0
- package/src/modules/customers/api/dictionaries/[kind]/[id]/route.ts +9 -0
- package/src/modules/customers/api/dictionaries/[kind]/route.ts +5 -0
- package/src/modules/customers/api/dictionaries/kind-settings/route.ts +5 -0
- package/src/modules/customers/api/interactions/cancel/route.ts +5 -0
- package/src/modules/customers/api/interactions/complete/route.ts +5 -0
- package/src/modules/customers/api/labels/assign/route.ts +5 -0
- package/src/modules/customers/api/labels/route.ts +5 -0
- package/src/modules/customers/api/labels/unassign/route.ts +5 -0
- package/src/modules/customers/api/people/[id]/companies/[linkId]/route.ts +9 -0
- package/src/modules/customers/api/people/[id]/companies/route.ts +5 -0
- package/src/modules/customers/api/pipeline-stages/reorder/route.ts +5 -0
- package/src/modules/customers/api/pipeline-stages/route.ts +13 -0
- package/src/modules/customers/api/pipelines/route.ts +13 -0
- package/src/modules/customers/api/settings/address-format/route.ts +5 -0
- package/src/modules/customers/api/settings/dictionary-sort-modes/route.ts +5 -0
- package/src/modules/customers/api/settings/stuck-threshold/route.ts +5 -0
- package/src/modules/customers/api/tags/assign/route.ts +5 -0
- package/src/modules/customers/api/tags/unassign/route.ts +5 -0
- package/src/modules/customers/api/todos/route.ts +13 -0
- package/src/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.ts +9 -0
- package/src/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.ts +5 -0
- package/src/modules/dictionaries/api/[dictionaryId]/entries/route.ts +5 -0
- package/src/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.ts +5 -0
- package/src/modules/directory/api/organization-branding/route.ts +5 -0
- package/src/modules/eudr/api/plots/import/route.ts +7 -0
- package/src/modules/eudr/api/product-mappings/suggestions/apply/route.ts +7 -0
- package/src/modules/feature_toggles/api/overrides/route.ts +5 -0
- package/src/modules/messages/api/[id]/actions/[actionId]/route.ts +5 -0
- package/src/modules/messages/api/[id]/conversation/archive/route.ts +5 -0
- package/src/modules/messages/api/[id]/conversation/read/route.ts +5 -0
- package/src/modules/messages/api/[id]/conversation/route.ts +5 -0
- package/src/modules/messages/api/[id]/forward/route.ts +5 -0
- package/src/modules/messages/api/[id]/reply/route.ts +5 -0
- package/src/modules/messages/api/[id]/route.ts +9 -0
- package/src/modules/messages/api/token/[token]/route.ts +5 -0
- package/src/modules/resources/api/resources/tags/assign/route.ts +5 -0
- package/src/modules/resources/api/resources/tags/unassign/route.ts +5 -0
- package/src/modules/sales/api/quotes/accept/route.ts +5 -0
- package/src/modules/sales/api/quotes/convert/route.ts +5 -0
- package/src/modules/sales/api/settings/document-numbers/route.ts +5 -0
- package/src/modules/sales/api/settings/order-editing/route.ts +5 -0
- package/src/modules/staff/api/leave-requests/accept/route.ts +5 -0
- package/src/modules/staff/api/leave-requests/reject/route.ts +5 -0
- package/src/modules/staff/api/team-members/self/route.ts +5 -0
- package/src/modules/staff/api/team-members/tags/assign/route.ts +5 -0
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +5 -0
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +5 -0
- package/src/modules/translations/api/[entityType]/[entityId]/route.ts +9 -0
- package/src/modules/warranty_claims/api/ai/assess/route.ts +5 -0
- package/src/modules/warranty_claims/api/assign/route.ts +5 -0
- package/src/modules/warranty_claims/api/credit-memo/route.ts +5 -0
- package/src/modules/warranty_claims/api/events/route.ts +5 -0
- package/src/modules/warranty_claims/api/portal/claims/[id]/submit/route.ts +5 -0
- package/src/modules/warranty_claims/api/portal/claims/[id]/withdraw/route.ts +5 -0
- package/src/modules/warranty_claims/api/portal/claims/route.ts +5 -0
- package/src/modules/warranty_claims/api/portal/events/route.ts +5 -0
- package/src/modules/warranty_claims/api/receiving/route.ts +5 -0
- package/src/modules/warranty_claims/api/replacement-order/route.ts +5 -0
- package/src/modules/warranty_claims/api/return-label/route.ts +5 -0
- package/src/modules/warranty_claims/api/sales-return/route.ts +5 -0
- package/src/modules/warranty_claims/api/settings-general/route.ts +5 -0
- package/src/modules/warranty_claims/api/submit/route.ts +5 -0
- package/src/modules/warranty_claims/api/transition/route.ts +5 -0
- package/src/modules/warranty_claims/api/vendor-recovery/route.ts +5 -0
- package/src/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.ts +5 -0
|
@@ -13,6 +13,7 @@ import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/op
|
|
|
13
13
|
import { enforceCommandOptimisticLockWithGuards } from '@open-mercato/shared/lib/crud/optimistic-lock-command'
|
|
14
14
|
import type { OpenApiMethodDoc, OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
15
15
|
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
16
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
16
17
|
|
|
17
18
|
const logger = createLogger('translations').child({ component: 'entity-translations' })
|
|
18
19
|
|
|
@@ -226,6 +227,10 @@ export async function PUT(req: Request, ctx: { params?: { entityType?: string; e
|
|
|
226
227
|
if (isCrudHttpError(err)) {
|
|
227
228
|
return NextResponse.json(err.body, { status: err.status })
|
|
228
229
|
}
|
|
230
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
231
|
+
if (interceptorRejection) {
|
|
232
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
233
|
+
}
|
|
229
234
|
if (err instanceof z.ZodError) {
|
|
230
235
|
return NextResponse.json({ error: 'Validation failed', details: err.issues }, { status: 400 })
|
|
231
236
|
}
|
|
@@ -331,6 +336,10 @@ export async function DELETE(req: Request, ctx: { params?: { entityType?: string
|
|
|
331
336
|
if (isCrudHttpError(err)) {
|
|
332
337
|
return NextResponse.json(err.body, { status: err.status })
|
|
333
338
|
}
|
|
339
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
340
|
+
if (interceptorRejection) {
|
|
341
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
342
|
+
}
|
|
334
343
|
if (err instanceof z.ZodError) {
|
|
335
344
|
return NextResponse.json({ error: 'Invalid parameters', details: err.issues }, { status: 400 })
|
|
336
345
|
}
|
|
@@ -7,6 +7,7 @@ import { getAuthFromRequest, type AuthContext } from '@open-mercato/shared/lib/a
|
|
|
7
7
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
8
8
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
9
9
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
10
11
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
11
12
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
12
13
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -338,6 +339,10 @@ export async function POST(req: Request) {
|
|
|
338
339
|
return NextResponse.json({ status: 'ok', extraction })
|
|
339
340
|
} catch (err) {
|
|
340
341
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
342
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
343
|
+
if (interceptorRejection) {
|
|
344
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
345
|
+
}
|
|
341
346
|
if (isWarrantyAiNotConfiguredError(err)) {
|
|
342
347
|
return NextResponse.json({ status: 'notConfigured' })
|
|
343
348
|
}
|
|
@@ -6,6 +6,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
8
8
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
9
10
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
10
11
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
11
12
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -114,6 +115,10 @@ export async function POST(req: Request) {
|
|
|
114
115
|
return NextResponse.json({ ok: true, claimId: result?.claimId ?? commandInput.id })
|
|
115
116
|
} catch (err) {
|
|
116
117
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
118
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
119
|
+
if (interceptorRejection) {
|
|
120
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
121
|
+
}
|
|
117
122
|
const { translate } = await resolveTranslations()
|
|
118
123
|
if (err instanceof z.ZodError) {
|
|
119
124
|
return NextResponse.json({ error: translate('warranty_claims.errors.invalidInput', 'Invalid input') }, { status: 400 })
|
|
@@ -5,6 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
8
9
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
9
10
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
10
11
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -159,6 +160,10 @@ export async function POST(req: Request) {
|
|
|
159
160
|
})
|
|
160
161
|
} catch (err) {
|
|
161
162
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
163
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
164
|
+
if (interceptorRejection) {
|
|
165
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
166
|
+
}
|
|
162
167
|
if (err instanceof z.ZodError) {
|
|
163
168
|
return NextResponse.json({ error: 'warranty_claims.errors.invalidInput' }, { status: 400 })
|
|
164
169
|
}
|
|
@@ -7,6 +7,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
7
7
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
8
8
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
9
9
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
10
11
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
11
12
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
12
13
|
import { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
@@ -175,6 +176,10 @@ export async function POST(req: Request) {
|
|
|
175
176
|
return NextResponse.json({ ok: true, claimId: result?.claimId ?? commandInput.claimId })
|
|
176
177
|
} catch (err) {
|
|
177
178
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
179
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
180
|
+
if (interceptorRejection) {
|
|
181
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
182
|
+
}
|
|
178
183
|
const { translate } = await resolveTranslations()
|
|
179
184
|
if (err instanceof z.ZodError) {
|
|
180
185
|
return NextResponse.json({ error: translate('warranty_claims.errors.invalidInput', 'Invalid input') }, { status: 400 })
|
|
@@ -2,6 +2,7 @@ import { NextResponse } from 'next/server'
|
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
import type { CommandBus } from '@open-mercato/shared/lib/commands'
|
|
4
4
|
import { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
5
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
5
6
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
6
7
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
7
8
|
import {
|
|
@@ -55,6 +56,10 @@ export async function POST(req: Request, ctx: PortalClaimActionRouteContext) {
|
|
|
55
56
|
if (isCrudHttpError(err)) {
|
|
56
57
|
return NextResponse.json(err.body, { status: err.status })
|
|
57
58
|
}
|
|
59
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
60
|
+
if (interceptorRejection) {
|
|
61
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
62
|
+
}
|
|
58
63
|
throw err
|
|
59
64
|
}
|
|
60
65
|
|
|
@@ -2,6 +2,7 @@ import { NextResponse } from 'next/server'
|
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
import type { CommandBus } from '@open-mercato/shared/lib/commands'
|
|
4
4
|
import { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
5
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
5
6
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
6
7
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
7
8
|
import type { TransitionClaimInput, WarrantyClaimStatus } from '../../../../../data/validators'
|
|
@@ -61,6 +62,10 @@ export async function POST(req: Request, ctx: PortalClaimActionRouteContext) {
|
|
|
61
62
|
if (isCrudHttpError(err)) {
|
|
62
63
|
return NextResponse.json(err.body, { status: err.status })
|
|
63
64
|
}
|
|
65
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
66
|
+
if (interceptorRejection) {
|
|
67
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
68
|
+
}
|
|
64
69
|
throw err
|
|
65
70
|
}
|
|
66
71
|
|
|
@@ -5,6 +5,7 @@ import type { AuthContext } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
8
9
|
import { escapeLikePattern } from '@open-mercato/shared/lib/db/escapeLikePattern'
|
|
9
10
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
10
11
|
import { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
@@ -522,6 +523,10 @@ export async function POST(req: Request) {
|
|
|
522
523
|
if (isCrudHttpError(err)) {
|
|
523
524
|
return NextResponse.json(err.body, { status: err.status })
|
|
524
525
|
}
|
|
526
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
527
|
+
if (interceptorRejection) {
|
|
528
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
529
|
+
}
|
|
525
530
|
throw err
|
|
526
531
|
}
|
|
527
532
|
}
|
|
@@ -5,6 +5,7 @@ import type { AuthContext } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
8
9
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
9
10
|
import { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
10
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -213,6 +214,10 @@ export async function POST(req: Request) {
|
|
|
213
214
|
if (isCrudHttpError(err)) {
|
|
214
215
|
return NextResponse.json(err.body, { status: err.status })
|
|
215
216
|
}
|
|
217
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
218
|
+
if (interceptorRejection) {
|
|
219
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
220
|
+
}
|
|
216
221
|
throw err
|
|
217
222
|
}
|
|
218
223
|
|
|
@@ -5,6 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
8
9
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
9
10
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
10
11
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -184,6 +185,10 @@ export async function POST(req: Request) {
|
|
|
184
185
|
return NextResponse.json({ ok: true, lineId: result.lineId, claimId: result.claimId })
|
|
185
186
|
} catch (err) {
|
|
186
187
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
188
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
189
|
+
if (interceptorRejection) {
|
|
190
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
191
|
+
}
|
|
187
192
|
if (err instanceof z.ZodError) {
|
|
188
193
|
return NextResponse.json({ error: 'warranty_claims.errors.invalidInput' }, { status: 400 })
|
|
189
194
|
}
|
|
@@ -5,6 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
8
9
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
9
10
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
10
11
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -156,6 +157,10 @@ export async function POST(req: Request) {
|
|
|
156
157
|
})
|
|
157
158
|
} catch (err) {
|
|
158
159
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
160
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
161
|
+
if (interceptorRejection) {
|
|
162
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
163
|
+
}
|
|
159
164
|
if (err instanceof z.ZodError) {
|
|
160
165
|
return NextResponse.json({ error: 'warranty_claims.errors.invalidInput' }, { status: 400 })
|
|
161
166
|
}
|
|
@@ -6,6 +6,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
6
6
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
7
7
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
8
8
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
9
10
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
10
11
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
11
12
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -264,6 +265,10 @@ export async function POST(req: Request) {
|
|
|
264
265
|
return NextResponse.json(response)
|
|
265
266
|
} catch (err) {
|
|
266
267
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
268
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
269
|
+
if (interceptorRejection) {
|
|
270
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
271
|
+
}
|
|
267
272
|
if (err instanceof z.ZodError) {
|
|
268
273
|
return NextResponse.json({ error: firstTranslatableIssueKey(err) }, { status: 400 })
|
|
269
274
|
}
|
|
@@ -5,6 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
8
9
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
9
10
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
10
11
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -148,6 +149,10 @@ export async function POST(req: Request) {
|
|
|
148
149
|
return NextResponse.json({ salesReturnId: result.salesReturnId, skippedLineIds: result.skippedLineIds })
|
|
149
150
|
} catch (err) {
|
|
150
151
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
152
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
153
|
+
if (interceptorRejection) {
|
|
154
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
155
|
+
}
|
|
151
156
|
if (err instanceof z.ZodError) {
|
|
152
157
|
return NextResponse.json({ error: 'warranty_claims.errors.invalidInput' }, { status: 400 })
|
|
153
158
|
}
|
|
@@ -7,6 +7,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
7
7
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
8
8
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
9
9
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
10
11
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
11
12
|
import { runRouteMutationGuards } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
12
13
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -165,6 +166,10 @@ export async function PUT(req: Request) {
|
|
|
165
166
|
})
|
|
166
167
|
} catch (err) {
|
|
167
168
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
169
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
170
|
+
if (interceptorRejection) {
|
|
171
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
172
|
+
}
|
|
168
173
|
const { translate } = await resolveTranslations()
|
|
169
174
|
if (err instanceof z.ZodError) {
|
|
170
175
|
return NextResponse.json({ error: translate('warranty_claims.errors.invalidInput', 'Invalid input') }, { status: 400 })
|
|
@@ -6,6 +6,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
8
8
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
9
10
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
10
11
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
11
12
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -118,6 +119,10 @@ export async function POST(req: Request) {
|
|
|
118
119
|
return NextResponse.json({ ok: true, claimId: result?.claimId ?? commandInput.id })
|
|
119
120
|
} catch (err) {
|
|
120
121
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
122
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
123
|
+
if (interceptorRejection) {
|
|
124
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
125
|
+
}
|
|
121
126
|
const { translate } = await resolveTranslations()
|
|
122
127
|
if (err instanceof z.ZodError) {
|
|
123
128
|
return NextResponse.json({ error: translate('warranty_claims.errors.invalidInput', 'Invalid input') }, { status: 400 })
|
|
@@ -6,6 +6,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
8
8
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
9
10
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
10
11
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
11
12
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -116,6 +117,10 @@ export async function POST(req: Request) {
|
|
|
116
117
|
return NextResponse.json({ ok: true, claimId: result?.claimId ?? commandInput.id })
|
|
117
118
|
} catch (err) {
|
|
118
119
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
120
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
121
|
+
if (interceptorRejection) {
|
|
122
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
123
|
+
}
|
|
119
124
|
const { translate } = await resolveTranslations()
|
|
120
125
|
if (err instanceof z.ZodError) {
|
|
121
126
|
return NextResponse.json({ error: translate('warranty_claims.errors.invalidInput', 'Invalid input') }, { status: 400 })
|
|
@@ -6,6 +6,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
8
8
|
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
9
10
|
import { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'
|
|
10
11
|
import { runRouteMutationGuards, type RouteMutationGuardResult } from '@open-mercato/shared/lib/crud/route-mutation-guard'
|
|
11
12
|
import { withScopedPayload } from '@open-mercato/shared/lib/api/scoped'
|
|
@@ -120,6 +121,10 @@ export async function POST(req: Request) {
|
|
|
120
121
|
return NextResponse.json({ ok: true, claimId: createdClaimId })
|
|
121
122
|
} catch (err) {
|
|
122
123
|
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
124
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(err)
|
|
125
|
+
if (interceptorRejection) {
|
|
126
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
127
|
+
}
|
|
123
128
|
const { translate } = await resolveTranslations()
|
|
124
129
|
if (err instanceof z.ZodError) {
|
|
125
130
|
return NextResponse.json({ error: translate('warranty_claims.errors.invalidInput', 'Invalid input') }, { status: 400 })
|
|
@@ -17,6 +17,7 @@ import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
|
17
17
|
import { salesOrderWarehouseAssignBodySchema } from '../../../../data/validators'
|
|
18
18
|
import { loadSalesOrderWarehouseAssignmentView } from '../../../../lib/salesOrderWarehouseAssignment'
|
|
19
19
|
import { executeWmsCustomPostRoute } from '../../../inventory/helpers'
|
|
20
|
+
import { getCommandInterceptorHttpRejection } from '@open-mercato/shared/lib/commands/errors'
|
|
20
21
|
|
|
21
22
|
const logger = createLogger('wms')
|
|
22
23
|
|
|
@@ -241,6 +242,10 @@ export async function DELETE(
|
|
|
241
242
|
}
|
|
242
243
|
return NextResponse.json(intercepted.body, { status: intercepted.statusCode })
|
|
243
244
|
} catch (error) {
|
|
245
|
+
const interceptorRejection = getCommandInterceptorHttpRejection(error)
|
|
246
|
+
if (interceptorRejection) {
|
|
247
|
+
return NextResponse.json(interceptorRejection.body, { status: interceptorRejection.status })
|
|
248
|
+
}
|
|
244
249
|
if (error instanceof CrudHttpError) {
|
|
245
250
|
return NextResponse.json(error.body, { status: error.status })
|
|
246
251
|
}
|