@open-mercato/core 0.6.3-develop.3881.1.0b590ac4eb → 0.6.3-develop.3894.1.352abf4240
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/auth/backend/auth/profile/page.js +1 -1
- package/dist/modules/auth/backend/auth/profile/page.js.map +2 -2
- package/dist/modules/auth/backend/profile/change-password/page.js +1 -1
- package/dist/modules/auth/backend/profile/change-password/page.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.js +1 -1
- package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
- package/dist/modules/auth/backend/users/create/page.js +6 -1
- package/dist/modules/auth/backend/users/create/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +8 -1
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js +3 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/create/page.js +3 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/create/page.js.map +2 -2
- package/dist/modules/configs/cli.js +27 -14
- package/dist/modules/configs/cli.js.map +2 -2
- package/dist/modules/resources/backend/resources/resource-types/[id]/edit/page.js +1 -1
- package/dist/modules/resources/backend/resources/resource-types/[id]/edit/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js +1 -1
- package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js.map +2 -2
- package/dist/modules/sales/components/channels/ChannelOfferForm.js +1 -1
- package/dist/modules/sales/components/channels/ChannelOfferForm.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/auth/backend/auth/profile/page.tsx +1 -1
- package/src/modules/auth/backend/profile/change-password/page.tsx +1 -1
- package/src/modules/auth/backend/users/[id]/edit/page.tsx +1 -1
- package/src/modules/auth/backend/users/create/page.tsx +6 -1
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +8 -1
- package/src/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.tsx +3 -2
- package/src/modules/catalog/backend/catalog/products/[productId]/variants/create/page.tsx +3 -2
- package/src/modules/configs/cli.ts +34 -13
- package/src/modules/resources/backend/resources/resource-types/[id]/edit/page.tsx +1 -1
- package/src/modules/sales/backend/sales/channels/[channelId]/edit/page.tsx +1 -1
- package/src/modules/sales/components/channels/ChannelOfferForm.tsx +1 -1
|
@@ -55,7 +55,7 @@ export default function AuthProfilePage() {
|
|
|
55
55
|
setError(null)
|
|
56
56
|
try {
|
|
57
57
|
const { ok, result } = await apiCall<ProfileResponse>('/api/auth/profile')
|
|
58
|
-
if (!ok) throw new Error('
|
|
58
|
+
if (!ok) throw new Error(t('auth.profile.form.errors.load', 'Failed to load profile.'))
|
|
59
59
|
const resolvedEmail = typeof result?.email === 'string' ? result.email : ''
|
|
60
60
|
if (!cancelled) setEmail(resolvedEmail)
|
|
61
61
|
} catch (err) {
|
|
@@ -54,7 +54,7 @@ export default function ProfileChangePasswordPage() {
|
|
|
54
54
|
setError(null)
|
|
55
55
|
try {
|
|
56
56
|
const { ok, result } = await apiCall<ProfileResponse>('/api/auth/profile')
|
|
57
|
-
if (!ok) throw new Error('
|
|
57
|
+
if (!ok) throw new Error(t('auth.profile.form.errors.load', 'Failed to load profile.'))
|
|
58
58
|
const resolvedEmail = typeof result?.email === 'string' ? result.email : ''
|
|
59
59
|
if (!cancelled) setEmail(resolvedEmail)
|
|
60
60
|
} catch (err) {
|
|
@@ -176,7 +176,7 @@ export default function EditUserPage({ params }: { params?: { id?: string } }) {
|
|
|
176
176
|
const { ok, result } = await apiCall<UserListResponse>(
|
|
177
177
|
`/api/auth/users?id=${encodeURIComponent(String(id))}&page=1&pageSize=1`,
|
|
178
178
|
)
|
|
179
|
-
if (!ok) throw new Error('
|
|
179
|
+
if (!ok) throw new Error(tRef.current('auth.users.form.errors.load', 'Failed to load user data'))
|
|
180
180
|
const item = Array.isArray(result?.items) ? result?.items?.[0] : undefined
|
|
181
181
|
if (!cancelled) {
|
|
182
182
|
setActorIsSuperAdmin(Boolean(result?.isSuperAdmin))
|
|
@@ -109,7 +109,12 @@ export default function CreateUserPage() {
|
|
|
109
109
|
setWidgetError(null)
|
|
110
110
|
try {
|
|
111
111
|
const { ok, result } = await apiCall<WidgetCatalogResponse>('/api/dashboards/widgets/catalog')
|
|
112
|
-
if (!ok)
|
|
112
|
+
if (!ok) {
|
|
113
|
+
throw new Error(t(
|
|
114
|
+
'auth.users.widgets.errors.load',
|
|
115
|
+
'Unable to load dashboard widgets. You can configure them later from the user page.',
|
|
116
|
+
))
|
|
117
|
+
}
|
|
113
118
|
if (!cancelled) {
|
|
114
119
|
const rawItems: unknown[] = Array.isArray(result?.items) ? result?.items ?? [] : []
|
|
115
120
|
const normalized = rawItems
|
|
@@ -556,7 +556,14 @@ export default function EditCatalogProductPage({
|
|
|
556
556
|
const productRes = await apiCall<ProductResponse>(
|
|
557
557
|
`/api/catalog/products?id=${encodeURIComponent(productId!)}&page=1&pageSize=1&withDeleted=false`,
|
|
558
558
|
);
|
|
559
|
-
if (!productRes.ok)
|
|
559
|
+
if (!productRes.ok) {
|
|
560
|
+
throw new Error(
|
|
561
|
+
t(
|
|
562
|
+
"catalog.products.edit.errors.load",
|
|
563
|
+
"Failed to load product details.",
|
|
564
|
+
),
|
|
565
|
+
);
|
|
566
|
+
}
|
|
560
567
|
const record = Array.isArray(productRes.result?.items)
|
|
561
568
|
? productRes.result?.items?.[0]
|
|
562
569
|
: undefined;
|
package/src/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors
|
|
|
9
9
|
import { collectCustomFieldValues } from '@open-mercato/ui/backend/utils/customFieldValues'
|
|
10
10
|
import { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
11
11
|
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
12
|
+
import { ErrorMessage } from '@open-mercato/ui/backend/detail'
|
|
12
13
|
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
13
14
|
import { extractCustomFieldEntries } from '@open-mercato/shared/lib/crud/custom-fields-client'
|
|
14
15
|
import { E } from '#generated/entities.ids.generated'
|
|
@@ -165,7 +166,7 @@ export default function EditVariantPage({ params }: { params?: { productId?: str
|
|
|
165
166
|
const variantRes = await apiCall<VariantResponse>(
|
|
166
167
|
`/api/catalog/variants?id=${encodeURIComponent(variantId!)}&page=1&pageSize=1`,
|
|
167
168
|
)
|
|
168
|
-
if (!variantRes.ok) throw new Error('
|
|
169
|
+
if (!variantRes.ok) throw new Error(t('catalog.variants.form.errors.load', 'Failed to load variant.'))
|
|
169
170
|
const record = Array.isArray(variantRes.result?.items) ? variantRes.result?.items?.[0] : undefined
|
|
170
171
|
if (!record) throw new Error(t('catalog.variants.form.errors.notFound', 'Variant not found.'))
|
|
171
172
|
const resolvedProductId =
|
|
@@ -421,7 +422,7 @@ export default function EditVariantPage({ params }: { params?: { productId?: str
|
|
|
421
422
|
<Page>
|
|
422
423
|
<PageBody>
|
|
423
424
|
{error ? (
|
|
424
|
-
<
|
|
425
|
+
<ErrorMessage label={error} className="mb-4" />
|
|
425
426
|
) : null}
|
|
426
427
|
<CrudForm<VariantFormValues>
|
|
427
428
|
title={formTitle}
|
|
@@ -9,6 +9,7 @@ import { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors
|
|
|
9
9
|
import { collectCustomFieldValues } from '@open-mercato/ui/backend/utils/customFieldValues'
|
|
10
10
|
import { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
11
11
|
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
12
|
+
import { ErrorMessage } from '@open-mercato/ui/backend/detail'
|
|
12
13
|
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
13
14
|
import { E } from '#generated/entities.ids.generated'
|
|
14
15
|
import {
|
|
@@ -136,7 +137,7 @@ export default function CreateVariantPage({ params }: { params?: { productId?: s
|
|
|
136
137
|
const res = await apiCall<ProductResponse>(
|
|
137
138
|
`/api/catalog/products?id=${encodeURIComponent(productId!)}&page=1&pageSize=1`,
|
|
138
139
|
)
|
|
139
|
-
if (!res.ok) throw new Error('
|
|
140
|
+
if (!res.ok) throw new Error(t('catalog.variants.form.errors.load', 'Failed to load product context.'))
|
|
140
141
|
const record = Array.isArray(res.result?.items) ? res.result?.items?.[0] : undefined
|
|
141
142
|
if (!record) throw new Error(t('catalog.products.edit.errors.notFound', 'Product not found.'))
|
|
142
143
|
const metadata = (record.metadata ?? {}) as Record<string, unknown>
|
|
@@ -298,7 +299,7 @@ export default function CreateVariantPage({ params }: { params?: { productId?: s
|
|
|
298
299
|
<Page>
|
|
299
300
|
<PageBody>
|
|
300
301
|
{error ? (
|
|
301
|
-
<
|
|
302
|
+
<ErrorMessage label={error} className="mb-4" />
|
|
302
303
|
) : null}
|
|
303
304
|
<CrudForm<VariantFormValues>
|
|
304
305
|
title={formTitle}
|
|
@@ -16,6 +16,12 @@ import { touchGeneratedBarrels } from './lib/touchGeneratedBarrels'
|
|
|
16
16
|
|
|
17
17
|
type ParsedArgs = Record<string, string | boolean>
|
|
18
18
|
|
|
19
|
+
export const STRUCTURAL_CACHE_REQUESTS: CachePurgeRequest[] = [
|
|
20
|
+
{ kind: 'pattern', pattern: 'nav:*' },
|
|
21
|
+
{ kind: 'segment', segment: 'admin-nav' },
|
|
22
|
+
{ kind: 'segment', segment: 'portal-nav' },
|
|
23
|
+
]
|
|
24
|
+
|
|
19
25
|
type CacheScope = {
|
|
20
26
|
label: string
|
|
21
27
|
tenantId: string | null
|
|
@@ -157,7 +163,7 @@ function printCacheHelp() {
|
|
|
157
163
|
console.log('ℹ️ Notes:')
|
|
158
164
|
console.log(' `stats` mirrors the cache admin page segment overview for CRUD/widget caches.')
|
|
159
165
|
console.log(' `purge --id` removes every key whose name contains the provided token (for example a user id or entity id).')
|
|
160
|
-
console.log(' `structural` targets navigation caches
|
|
166
|
+
console.log(' `structural` targets navigation/sidebar caches and is the recommended post-step after module/sidebar structure changes.')
|
|
161
167
|
console.log(' When no scope flag is supplied, this command uses the global cache scope only.')
|
|
162
168
|
}
|
|
163
169
|
|
|
@@ -201,11 +207,14 @@ async function runCacheStats(args: ParsedArgs) {
|
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
209
|
|
|
204
|
-
async function
|
|
210
|
+
async function runCachePurgeRequest(
|
|
211
|
+
args: ParsedArgs,
|
|
212
|
+
request: CachePurgeRequest,
|
|
213
|
+
emitOutput = true,
|
|
214
|
+
) {
|
|
205
215
|
const json = flagEnabled(args, 'json')
|
|
206
216
|
const quiet = flagEnabled(args, 'quiet')
|
|
207
217
|
const dryRun = flagEnabled(args, 'dry-run', 'dryRun')
|
|
208
|
-
const request = resolveCachePurgeRequest(args)
|
|
209
218
|
const container = await createRequestContainer()
|
|
210
219
|
try {
|
|
211
220
|
const em = container.resolve('em') as EntityManager
|
|
@@ -228,13 +237,13 @@ async function runCachePurge(args: ParsedArgs) {
|
|
|
228
237
|
})
|
|
229
238
|
}
|
|
230
239
|
|
|
231
|
-
if (json) {
|
|
240
|
+
if (json && emitOutput) {
|
|
232
241
|
console.log(JSON.stringify(results, null, 2))
|
|
233
|
-
return
|
|
242
|
+
return results
|
|
234
243
|
}
|
|
235
244
|
|
|
236
|
-
if (quiet) {
|
|
237
|
-
return
|
|
245
|
+
if (quiet || !emitOutput) {
|
|
246
|
+
return results
|
|
238
247
|
}
|
|
239
248
|
|
|
240
249
|
for (const result of results) {
|
|
@@ -246,22 +255,34 @@ async function runCachePurge(args: ParsedArgs) {
|
|
|
246
255
|
}
|
|
247
256
|
}
|
|
248
257
|
}
|
|
258
|
+
return results
|
|
249
259
|
} finally {
|
|
250
260
|
await disposeContainer(container)
|
|
251
261
|
}
|
|
252
262
|
}
|
|
253
263
|
|
|
264
|
+
async function runCachePurge(args: ParsedArgs) {
|
|
265
|
+
await runCachePurgeRequest(args, resolveCachePurgeRequest(args))
|
|
266
|
+
}
|
|
267
|
+
|
|
254
268
|
async function runStructuralCachePurge(args: ParsedArgs) {
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
269
|
+
const json = flagEnabled(args, 'json')
|
|
270
|
+
const structuralResults: Array<{
|
|
271
|
+
request: CachePurgeRequest
|
|
272
|
+
results: Awaited<ReturnType<typeof runCachePurgeRequest>>
|
|
273
|
+
}> = []
|
|
274
|
+
for (const request of STRUCTURAL_CACHE_REQUESTS) {
|
|
275
|
+
const results = await runCachePurgeRequest(args, request, !json)
|
|
276
|
+
structuralResults.push({ request, results })
|
|
277
|
+
}
|
|
278
|
+
if (json) {
|
|
279
|
+
console.log(JSON.stringify(structuralResults, null, 2))
|
|
258
280
|
}
|
|
259
|
-
await runCachePurge(nextArgs)
|
|
260
281
|
const quiet = flagEnabled(args, 'quiet')
|
|
261
282
|
try {
|
|
262
|
-
touchGeneratedBarrels({ quiet })
|
|
283
|
+
touchGeneratedBarrels({ quiet: quiet || json })
|
|
263
284
|
} catch (err) {
|
|
264
|
-
if (!quiet) {
|
|
285
|
+
if (!quiet && !json) {
|
|
265
286
|
console.warn(
|
|
266
287
|
`[structural] failed to touch generated barrels: ${(err as Error).message ?? err}`,
|
|
267
288
|
)
|
|
@@ -37,7 +37,7 @@ export default function ResourcesResourceTypeEditPage({ params }: { params?: { i
|
|
|
37
37
|
{ errorMessage: t('resources.resourceTypes.errors.load', 'Failed to load resource types.') },
|
|
38
38
|
)
|
|
39
39
|
const item = Array.isArray(payload.items) ? payload.items[0] : null
|
|
40
|
-
if (!item) throw new Error('
|
|
40
|
+
if (!item) throw new Error(t('resources.resourceTypes.errors.notFound', 'Resource type not found.'))
|
|
41
41
|
if (!cancelled) {
|
|
42
42
|
const customValues = extractCustomFieldValues(item)
|
|
43
43
|
setInitialValues({
|
|
@@ -53,7 +53,7 @@ export default function EditChannelPage({ params }: { params?: { channelId?: str
|
|
|
53
53
|
)
|
|
54
54
|
const item = Array.isArray(payload.items) ? payload.items[0] : null
|
|
55
55
|
if (!item) {
|
|
56
|
-
throw new Error('
|
|
56
|
+
throw new Error(t('sales.channels.form.errors.notFound', 'Channel not found.'))
|
|
57
57
|
}
|
|
58
58
|
if (!cancelled) {
|
|
59
59
|
setInitialValues(mapChannelToFormValues(item))
|
|
@@ -291,7 +291,7 @@ export function ChannelOfferForm({ channelId: lockedChannelId, offerId, mode }:
|
|
|
291
291
|
{ errorMessage: t('sales.channels.offers.errors.loadOffer', 'Failed to load offer.') },
|
|
292
292
|
)
|
|
293
293
|
const offer = Array.isArray(payload.items) ? payload.items[0] : null
|
|
294
|
-
if (!offer) throw new Error('
|
|
294
|
+
if (!offer) throw new Error(t('sales.channels.offers.errors.notFound', 'Offer not found.'))
|
|
295
295
|
const values = mapOfferToFormValues(offer, lockedChannelId)
|
|
296
296
|
const pricePayload = await readApiResultOrThrow<PriceResponse>(
|
|
297
297
|
`/api/catalog/prices?offerId=${encodeURIComponent(offer.id as string)}&pageSize=${MAX_LIST_PAGE_SIZE}`,
|