@open-mercato/shared 0.6.2-develop.3467.1.2a1818709d → 0.6.3-canary.3483.1.98d4b4ecc7
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/AGENTS.md +24 -0
- package/dist/lib/bootstrap/factory.js +3 -1
- package/dist/lib/bootstrap/factory.js.map +2 -2
- package/dist/lib/commands/command-interceptor-store.js +3 -1
- package/dist/lib/commands/command-interceptor-store.js.map +2 -2
- package/dist/lib/crud/enricher-registry.js +3 -1
- package/dist/lib/crud/enricher-registry.js.map +2 -2
- package/dist/lib/crud/factory.js.map +1 -1
- package/dist/lib/crud/interceptor-registry.js +3 -1
- package/dist/lib/crud/interceptor-registry.js.map +2 -2
- package/dist/lib/di/container.js +16 -0
- package/dist/lib/di/container.js.map +2 -2
- package/dist/lib/middleware/page-executor.js +2 -1
- package/dist/lib/middleware/page-executor.js.map +2 -2
- package/dist/lib/modules/registry.js +2 -1
- package/dist/lib/modules/registry.js.map +2 -2
- package/dist/lib/notifications/handler-registry.js +3 -1
- package/dist/lib/notifications/handler-registry.js.map +2 -2
- package/dist/lib/version.js +1 -1
- package/dist/lib/version.js.map +1 -1
- package/dist/modules/overrides.js +857 -0
- package/dist/modules/overrides.js.map +2 -2
- package/dist/modules/registry.js +17 -4
- package/dist/modules/registry.js.map +2 -2
- package/dist/modules/widgets/injection-loader.js +10 -4
- package/dist/modules/widgets/injection-loader.js.map +2 -2
- package/jest.config.cjs +3 -1
- package/package.json +7 -7
- package/src/lib/bootstrap/factory.ts +3 -1
- package/src/lib/commands/command-interceptor-store.ts +3 -1
- package/src/lib/crud/enricher-registry.ts +3 -1
- package/src/lib/crud/factory.ts +2 -2
- package/src/lib/crud/interceptor-registry.ts +3 -1
- package/src/lib/di/container.ts +24 -4
- package/src/lib/middleware/page-executor.ts +2 -1
- package/src/lib/modules/registry.ts +2 -1
- package/src/lib/notifications/handler-registry.ts +3 -1
- package/src/modules/__tests__/contract-overrides.test.ts +332 -0
- package/src/modules/__tests__/overrides.test.ts +23 -22
- package/src/modules/__tests__/route-overrides.test.ts +441 -0
- package/src/modules/overrides.ts +1297 -27
- package/src/modules/registry.ts +27 -4
- package/src/modules/widgets/injection-loader.ts +10 -4
package/src/modules/registry.ts
CHANGED
|
@@ -4,6 +4,13 @@ import type { SyncCrudEventResult } from '../lib/crud/sync-event-types'
|
|
|
4
4
|
import type { DashboardWidgetModule } from './dashboard/widgets'
|
|
5
5
|
import type { InjectionAnyWidgetModule, ModuleInjectionTable } from './widgets/injection'
|
|
6
6
|
import type { IntegrationBundle, IntegrationDefinition } from './integrations/types'
|
|
7
|
+
import {
|
|
8
|
+
applyApiOverridesToManifests,
|
|
9
|
+
applyModuleOverridesToModules,
|
|
10
|
+
applyPageOverridesToManifests,
|
|
11
|
+
composeApiRouteOverrides,
|
|
12
|
+
composePageRouteOverrides,
|
|
13
|
+
} from './overrides'
|
|
7
14
|
|
|
8
15
|
// Context passed to dynamic metadata guards
|
|
9
16
|
export type RouteVisibilityContext = { path?: string; auth?: any }
|
|
@@ -396,7 +403,11 @@ export function findApiRouteManifestMatch<T extends { path: string; methods: Htt
|
|
|
396
403
|
let _backendRouteManifests: BackendRouteManifestEntry[] | null = null
|
|
397
404
|
|
|
398
405
|
export function registerBackendRouteManifests(routes: BackendRouteManifestEntry[]) {
|
|
399
|
-
|
|
406
|
+
const pageOverrides = composePageRouteOverrides()
|
|
407
|
+
const finalRoutes = Object.keys(pageOverrides).length === 0
|
|
408
|
+
? routes
|
|
409
|
+
: applyPageOverridesToManifests(routes, pageOverrides, 'backend')
|
|
410
|
+
_backendRouteManifests = sortRoutesBySpecificity(finalRoutes)
|
|
400
411
|
}
|
|
401
412
|
|
|
402
413
|
export function getBackendRouteManifests(): BackendRouteManifestEntry[] {
|
|
@@ -406,7 +417,11 @@ export function getBackendRouteManifests(): BackendRouteManifestEntry[] {
|
|
|
406
417
|
let _frontendRouteManifests: FrontendRouteManifestEntry[] | null = null
|
|
407
418
|
|
|
408
419
|
export function registerFrontendRouteManifests(routes: FrontendRouteManifestEntry[]) {
|
|
409
|
-
|
|
420
|
+
const pageOverrides = composePageRouteOverrides()
|
|
421
|
+
const finalRoutes = Object.keys(pageOverrides).length === 0
|
|
422
|
+
? routes
|
|
423
|
+
: applyPageOverridesToManifests(routes, pageOverrides, 'frontend')
|
|
424
|
+
_frontendRouteManifests = sortRoutesBySpecificity(finalRoutes)
|
|
410
425
|
}
|
|
411
426
|
|
|
412
427
|
export function getFrontendRouteManifests(): FrontendRouteManifestEntry[] {
|
|
@@ -416,7 +431,15 @@ export function getFrontendRouteManifests(): FrontendRouteManifestEntry[] {
|
|
|
416
431
|
let _apiRouteManifests: ApiRouteManifestEntry[] | null = null
|
|
417
432
|
|
|
418
433
|
export function registerApiRouteManifests(routes: ApiRouteManifestEntry[]) {
|
|
419
|
-
|
|
434
|
+
// Apply any `entry.overrides.routes.api` overrides registered through the
|
|
435
|
+
// unified `modules.ts` dispatcher or programmatic API before storing the
|
|
436
|
+
// manifest. The composer is cheap and returns an empty object when no
|
|
437
|
+
// overrides exist, so this is a no-op for apps that do not opt in.
|
|
438
|
+
const routeOverrides = composeApiRouteOverrides()
|
|
439
|
+
const finalRoutes = Object.keys(routeOverrides).length === 0
|
|
440
|
+
? routes
|
|
441
|
+
: applyApiOverridesToManifests(routes, routeOverrides)
|
|
442
|
+
_apiRouteManifests = sortRoutesBySpecificity(finalRoutes)
|
|
420
443
|
}
|
|
421
444
|
|
|
422
445
|
export function getApiRouteManifests(): ApiRouteManifestEntry[] {
|
|
@@ -430,7 +453,7 @@ export function registerCliModules(modules: Module[]) {
|
|
|
430
453
|
if (_cliModules !== null && process.env.NODE_ENV === 'development') {
|
|
431
454
|
console.debug('[Bootstrap] CLI modules re-registered (this may occur during HMR)')
|
|
432
455
|
}
|
|
433
|
-
_cliModules = modules
|
|
456
|
+
_cliModules = applyModuleOverridesToModules(modules)
|
|
434
457
|
}
|
|
435
458
|
|
|
436
459
|
export function getCliModules(): Module[] {
|
|
@@ -9,6 +9,10 @@ import type {
|
|
|
9
9
|
ModuleInjectionTable,
|
|
10
10
|
InjectionWidgetPlacement,
|
|
11
11
|
} from './injection'
|
|
12
|
+
import {
|
|
13
|
+
applyInjectionWidgetOverridesToEntries,
|
|
14
|
+
applyInjectionWidgetOverridesToTables,
|
|
15
|
+
} from '../overrides'
|
|
12
16
|
|
|
13
17
|
type LoadedWidgetModule = InjectionWidgetModule<any, any> & { metadata: InjectionWidgetMetadata }
|
|
14
18
|
type LoadedDataWidgetModule = InjectionDataWidgetModule & { metadata: InjectionWidgetMetadata }
|
|
@@ -137,8 +141,9 @@ export function registerCoreInjectionWidgets(entries: ModuleInjectionWidgetEntry
|
|
|
137
141
|
if (_coreInjectionWidgetEntries !== null && process.env.NODE_ENV === 'development') {
|
|
138
142
|
console.debug('[Bootstrap] Core injection widgets re-registered (this may occur during HMR)')
|
|
139
143
|
}
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
const finalEntries = applyInjectionWidgetOverridesToEntries(entries)
|
|
145
|
+
_coreInjectionWidgetEntries = finalEntries
|
|
146
|
+
writeGlobalInjectionWidgets(finalEntries)
|
|
142
147
|
notifyInjectionRegistryChanged()
|
|
143
148
|
}
|
|
144
149
|
|
|
@@ -159,8 +164,9 @@ export function registerCoreInjectionTables(tables: Array<{ moduleId: string; ta
|
|
|
159
164
|
if (_coreInjectionTables !== null && process.env.NODE_ENV === 'development') {
|
|
160
165
|
console.debug('[Bootstrap] Core injection tables re-registered (this may occur during HMR)')
|
|
161
166
|
}
|
|
162
|
-
|
|
163
|
-
|
|
167
|
+
const finalTables = applyInjectionWidgetOverridesToTables(tables)
|
|
168
|
+
_coreInjectionTables = finalTables
|
|
169
|
+
writeGlobalInjectionTables(finalTables)
|
|
164
170
|
notifyInjectionRegistryChanged()
|
|
165
171
|
}
|
|
166
172
|
|