@open-mercato/shared 0.6.8-develop.6931.1.4a1e1c786b → 0.6.8-develop.6940.1.177ea30c6e

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.
@@ -1,48 +1,56 @@
1
- export type ExtensionHostFamily =
2
- | 'generic'
3
- | 'menu'
4
- | 'data-table'
5
- | 'crud-form'
6
- | 'detail'
7
- | 'portal-page'
8
- | 'component-handle'
9
- | 'entity'
10
- | 'api-route'
11
- | 'command'
12
- | 'event'
13
- | 'query-lifecycle'
14
- | 'dashboard'
15
- | 'notification'
16
- | 'integration'
17
- | 'specialized-registry'
18
- | 'module-override'
19
-
20
- export type ExtensionHostCapability =
21
- | 'render-widget'
22
- | 'headless-widget'
23
- | 'menu-item'
24
- | 'column-widget'
25
- | 'row-action'
26
- | 'bulk-action'
27
- | 'filter-widget'
28
- | 'toolbar-widget'
29
- | 'field-widget'
30
- | 'lifecycle-handler'
31
- | 'component-replacement'
32
- | 'response-enricher'
33
- | 'query-enricher'
34
- | 'api-interceptor'
35
- | 'command-interceptor'
36
- | 'mutation-guard'
37
- | 'entity-extension'
38
- | 'async-subscriber'
39
- | 'sync-subscriber'
40
- | 'browser-client'
41
- | 'browser-portal'
42
- | 'registry-contribution'
43
- | 'module-override'
44
-
45
- export type ExtensionHostActivation = 'always' | 'host-opt-in' | 'caller-opt-in' | 'feature-gated'
1
+ export const EXTENSION_HOST_FAMILIES = [
2
+ 'generic',
3
+ 'menu',
4
+ 'data-table',
5
+ 'crud-form',
6
+ 'detail',
7
+ 'portal-page',
8
+ 'component-handle',
9
+ 'entity',
10
+ 'api-route',
11
+ 'command',
12
+ 'event',
13
+ 'query-lifecycle',
14
+ 'dashboard',
15
+ 'notification',
16
+ 'integration',
17
+ 'specialized-registry',
18
+ 'module-override',
19
+ ] as const
20
+
21
+ export type ExtensionHostFamily = (typeof EXTENSION_HOST_FAMILIES)[number]
22
+
23
+ export const EXTENSION_HOST_CAPABILITIES = [
24
+ 'render-widget',
25
+ 'headless-widget',
26
+ 'menu-item',
27
+ 'column-widget',
28
+ 'row-action',
29
+ 'bulk-action',
30
+ 'filter-widget',
31
+ 'toolbar-widget',
32
+ 'field-widget',
33
+ 'lifecycle-handler',
34
+ 'component-replacement',
35
+ 'response-enricher',
36
+ 'query-enricher',
37
+ 'api-interceptor',
38
+ 'command-interceptor',
39
+ 'mutation-guard',
40
+ 'entity-extension',
41
+ 'async-subscriber',
42
+ 'sync-subscriber',
43
+ 'browser-client',
44
+ 'browser-portal',
45
+ 'registry-contribution',
46
+ 'module-override',
47
+ ] as const
48
+
49
+ export type ExtensionHostCapability = (typeof EXTENSION_HOST_CAPABILITIES)[number]
50
+
51
+ export const EXTENSION_HOST_ACTIVATIONS = ['always', 'host-opt-in', 'caller-opt-in', 'feature-gated'] as const
52
+
53
+ export type ExtensionHostActivation = (typeof EXTENSION_HOST_ACTIVATIONS)[number]
46
54
 
47
55
  export type ExtensionPointPatternParameter = {
48
56
  source: string
@@ -180,6 +188,8 @@ export const DATA_TABLE_EXTENSION_SURFACES = [
180
188
  { key: 'emptyState', suffix: 'empty-state', capabilities: ['render-widget'], bound: false },
181
189
  ] as const satisfies readonly BoundExtensionSurface[]
182
190
 
191
+ export const DATA_TABLE_EXTENSION_SURFACE_KEYS = DATA_TABLE_EXTENSION_SURFACES.map((surface) => surface.key)
192
+
183
193
  export const CRUD_FORM_EXTENSION_SURFACES = [
184
194
  { key: 'base', suffix: null, capabilities: ['render-widget', 'lifecycle-handler'], bound: true },
185
195
  { key: 'header', suffix: 'header', capabilities: ['render-widget'], bound: true },
@@ -194,6 +204,8 @@ export const CRUD_FORM_EXTENSION_SURFACES = [
194
204
  { key: 'fieldAfter', suffix: 'field:{fieldId}:after', capabilities: ['render-widget'], bound: false },
195
205
  ] as const satisfies readonly BoundExtensionSurface[]
196
206
 
207
+ export const CRUD_FORM_EXTENSION_SURFACE_KEYS = CRUD_FORM_EXTENSION_SURFACES.map((surface) => surface.key)
208
+
197
209
  export const CRUD_FORM_LIFECYCLE_PHASES = [
198
210
  'transformValidation',
199
211
  'transformDisplayData',
@@ -251,29 +263,53 @@ export type ModuleFactRef = {
251
263
  factKey: string
252
264
  }
253
265
 
254
- export type ModuleExtensionContributionKind = ModuleExtensionContributionFact['kind']
266
+ export const MODULE_EXTENSION_CONTRIBUTION_KINDS = [
267
+ 'widget',
268
+ 'data-table',
269
+ 'crud-form',
270
+ 'component-override',
271
+ 'response-enricher',
272
+ 'api-interceptor',
273
+ 'command-interceptor',
274
+ 'mutation-guard',
275
+ 'entity-extension',
276
+ 'subscriber',
277
+ 'browser-reaction',
278
+ 'specialized-registry',
279
+ 'module-override',
280
+ ] as const
255
281
 
256
- export type ModuleExtensionActivationKind =
257
- | 'crud-response-enricher'
258
- | 'query-enricher'
259
- | 'mutation-guard'
260
- | 'api-interceptor-bridge'
261
- | 'command-interceptor-bridge'
262
- | 'widget-injection-consumer'
263
- | 'component-extension-consumer'
264
- | 'dashboard-host-consumer'
282
+ export type ModuleExtensionContributionKind = (typeof MODULE_EXTENSION_CONTRIBUTION_KINDS)[number]
283
+
284
+ export const MODULE_EXTENSION_ACTIVATION_KINDS = [
285
+ 'crud-response-enricher',
286
+ 'query-enricher',
287
+ 'mutation-guard',
288
+ 'api-interceptor-bridge',
289
+ 'command-interceptor-bridge',
290
+ 'widget-injection-consumer',
291
+ 'component-extension-consumer',
292
+ 'dashboard-host-consumer',
293
+ ] as const
294
+
295
+ export type ModuleExtensionActivationKind = (typeof MODULE_EXTENSION_ACTIVATION_KINDS)[number]
296
+
297
+ export const MODULE_EXTENSION_TARGET_KINDS = [
298
+ 'module',
299
+ 'entity',
300
+ 'api-route',
301
+ 'command',
302
+ 'widget-spot',
303
+ 'component',
304
+ 'event',
305
+ 'notification',
306
+ 'wildcard',
307
+ ] as const
308
+
309
+ export type ModuleExtensionTargetKind = (typeof MODULE_EXTENSION_TARGET_KINDS)[number]
265
310
 
266
311
  export type ModuleExtensionTargetRef = {
267
- kind:
268
- | 'module'
269
- | 'entity'
270
- | 'api-route'
271
- | 'command'
272
- | 'widget-spot'
273
- | 'component'
274
- | 'event'
275
- | 'notification'
276
- | 'wildcard'
312
+ kind: ModuleExtensionTargetKind
277
313
  id: string
278
314
  moduleId?: string
279
315
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
@@ -294,12 +330,15 @@ export type ModuleExtensionActivation = {
294
330
  bridge?: ModuleFactRef
295
331
  }
296
332
 
297
- export type ModuleExtensionResolution =
298
- | 'bound'
299
- | 'capability-only'
300
- | 'optional-target-missing'
301
- | 'wildcard'
302
- | 'unresolved'
333
+ export const MODULE_EXTENSION_RESOLUTIONS = [
334
+ 'bound',
335
+ 'capability-only',
336
+ 'optional-target-missing',
337
+ 'wildcard',
338
+ 'unresolved',
339
+ ] as const
340
+
341
+ export type ModuleExtensionResolution = (typeof MODULE_EXTENSION_RESOLUTIONS)[number]
303
342
 
304
343
  export type ModuleIncomingExtensionRef = {
305
344
  contributionId: string
@@ -335,10 +374,14 @@ export type ModuleExtensionSurfaceFacts = {
335
374
  unresolved: ModuleExtensionUnresolvedFact[]
336
375
  } & ModuleExtensionSurfaceFactsAdditions
337
376
 
377
+ export const MODULE_EXTENSION_HOST_RESOLUTIONS = ['exact', 'pattern', 'framework', 'fact-ref'] as const
378
+
379
+ export type ModuleExtensionHostResolution = (typeof MODULE_EXTENSION_HOST_RESOLUTIONS)[number]
380
+
338
381
  export type ModuleExtensionHostFact = {
339
382
  key: string
340
383
  id: string
341
- resolution: 'exact' | 'pattern' | 'framework' | 'fact-ref'
384
+ resolution: ModuleExtensionHostResolution
342
385
  family: ExtensionHostFamily
343
386
  ownerModule: string
344
387
  capabilities: ExtensionHostCapability[]
@@ -360,9 +403,20 @@ export type ModuleExtensionHostFact = {
360
403
  fallbacks?: string[]
361
404
  }
362
405
 
406
+ export const MODULE_EXTENSION_TARGET_RESOLUTIONS = [
407
+ 'exact',
408
+ 'pattern',
409
+ 'framework',
410
+ 'fact-ref',
411
+ 'optional-external',
412
+ 'unresolved',
413
+ ] as const
414
+
415
+ export type ModuleExtensionTargetResolution = (typeof MODULE_EXTENSION_TARGET_RESOLUTIONS)[number]
416
+
363
417
  export type ModuleExtensionTargetFact = {
364
418
  id: string
365
- resolution: 'exact' | 'pattern' | 'framework' | 'fact-ref' | 'optional-external' | 'unresolved'
419
+ resolution: ModuleExtensionTargetResolution
366
420
  factRef?: { factSection: string; factKey: string }
367
421
  optionalOwnerPackage?: string
368
422
  }
@@ -381,6 +435,24 @@ export type ModuleExtensionContributionBase = {
381
435
  source: { path: string; symbol?: string }
382
436
  }
383
437
 
438
+ export const MODULE_SPECIALIZED_REGISTRIES = [
439
+ 'notification',
440
+ 'integration',
441
+ 'search',
442
+ 'vector',
443
+ 'ai',
444
+ 'payment',
445
+ 'shipping',
446
+ 'currency',
447
+ 'workflow',
448
+ ] as const
449
+
450
+ export type ModuleSpecializedRegistry = (typeof MODULE_SPECIALIZED_REGISTRIES)[number]
451
+
452
+ export const COMPONENT_OVERRIDE_MODES = ['replace', 'wrapper', 'props'] as const
453
+
454
+ export type ModuleComponentOverrideMode = (typeof COMPONENT_OVERRIDE_MODES)[number]
455
+
384
456
  export type ModuleExtensionContributionFact = ModuleExtensionContributionBase & (
385
457
  | {
386
458
  kind: 'widget'
@@ -414,7 +486,7 @@ export type ModuleExtensionContributionFact = ModuleExtensionContributionBase &
414
486
  }
415
487
  | {
416
488
  kind: 'component-override'
417
- details: { handle: string; mode: 'replace' | 'wrapper' | 'props'; propsContract: string }
489
+ details: { handle: string; mode: ModuleComponentOverrideMode; propsContract: string }
418
490
  }
419
491
  | {
420
492
  kind: 'response-enricher'
@@ -498,7 +570,7 @@ export type ModuleExtensionContributionFact = ModuleExtensionContributionBase &
498
570
  | {
499
571
  kind: 'specialized-registry'
500
572
  details: {
501
- registry: 'notification' | 'integration' | 'search' | 'vector' | 'ai' | 'payment' | 'shipping' | 'currency' | 'workflow'
573
+ registry: ModuleSpecializedRegistry
502
574
  registryId: string
503
575
  specialistRoute: string
504
576
  }
@@ -513,12 +585,17 @@ export type ModuleExtensionContributionFact = ModuleExtensionContributionBase &
513
585
  }
514
586
  )
515
587
 
588
+ export const MODULE_EXTENSION_UNRESOLVED_REASONS = [
589
+ 'unclassified-binding',
590
+ 'unbound-declaration',
591
+ 'dynamic-without-pattern',
592
+ 'unresolved-first-party-target',
593
+ ] as const
594
+
595
+ export type ModuleExtensionUnresolvedReason = (typeof MODULE_EXTENSION_UNRESOLVED_REASONS)[number]
596
+
516
597
  export type ModuleExtensionUnresolvedFact = {
517
598
  key: string
518
599
  source: { path: string; symbol?: string }
519
- reason:
520
- | 'unclassified-binding'
521
- | 'unbound-declaration'
522
- | 'dynamic-without-pattern'
523
- | 'unresolved-first-party-target'
600
+ reason: ModuleExtensionUnresolvedReason
524
601
  }