@open-mercato/shared 0.6.7-develop.6788.1.c2a1520a30 → 0.6.7-develop.6814.1.0627c7e9f1

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 (54) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/AGENTS.md +1 -0
  3. package/dist/lib/auth/organizationScope.js +34 -0
  4. package/dist/lib/auth/organizationScope.js.map +7 -0
  5. package/dist/lib/di/container.js +33 -3
  6. package/dist/lib/di/container.js.map +2 -2
  7. package/dist/lib/email/send.js +56 -0
  8. package/dist/lib/email/send.js.map +2 -2
  9. package/dist/lib/query/engine.js +25 -42
  10. package/dist/lib/query/engine.js.map +2 -2
  11. package/dist/lib/query/types.js.map +1 -1
  12. package/dist/lib/search/availability.js +107 -0
  13. package/dist/lib/search/availability.js.map +7 -0
  14. package/dist/lib/search/config.js +24 -2
  15. package/dist/lib/search/config.js.map +2 -2
  16. package/dist/lib/search/tokenize.js +23 -11
  17. package/dist/lib/search/tokenize.js.map +2 -2
  18. package/dist/lib/version.js +1 -1
  19. package/dist/lib/version.js.map +1 -1
  20. package/dist/lib/webhooks/body.js +57 -0
  21. package/dist/lib/webhooks/body.js.map +7 -0
  22. package/dist/lib/webhooks/index.js +13 -1
  23. package/dist/lib/webhooks/index.js.map +2 -2
  24. package/dist/lib/webhooks/verify.js +12 -7
  25. package/dist/lib/webhooks/verify.js.map +2 -2
  26. package/dist/modules/payment_gateways/types.js +8 -1
  27. package/dist/modules/payment_gateways/types.js.map +2 -2
  28. package/dist/modules/widgets/extension-points.js.map +1 -1
  29. package/package.json +8 -8
  30. package/src/lib/auth/__tests__/organizationScope.test.ts +107 -0
  31. package/src/lib/auth/organizationScope.ts +65 -0
  32. package/src/lib/di/__tests__/container-app-di-absent.test.ts +139 -0
  33. package/src/lib/di/__tests__/container-app-di.test.ts +173 -0
  34. package/src/lib/di/container.ts +45 -4
  35. package/src/lib/email/__tests__/send.test.ts +37 -1
  36. package/src/lib/email/send.ts +79 -0
  37. package/src/lib/i18n/__tests__/server-dictionary-cache.test.ts +30 -0
  38. package/src/lib/query/__tests__/engine.test.ts +65 -13
  39. package/src/lib/query/engine.ts +36 -60
  40. package/src/lib/query/types.ts +4 -5
  41. package/src/lib/search/__tests__/availability.test.ts +211 -0
  42. package/src/lib/search/__tests__/config.test.ts +59 -0
  43. package/src/lib/search/__tests__/tokenize.test.ts +49 -0
  44. package/src/lib/search/availability.ts +232 -0
  45. package/src/lib/search/config.ts +28 -0
  46. package/src/lib/search/tokenize.ts +33 -11
  47. package/src/lib/webhooks/__tests__/body.test.ts +95 -0
  48. package/src/lib/webhooks/__tests__/verify.test.ts +20 -1
  49. package/src/lib/webhooks/body.ts +70 -0
  50. package/src/lib/webhooks/index.ts +7 -1
  51. package/src/lib/webhooks/verify.ts +17 -9
  52. package/src/modules/payment_gateways/__tests__/types.test.ts +37 -0
  53. package/src/modules/payment_gateways/types.ts +15 -0
  54. package/src/modules/widgets/extension-points.ts +104 -1
@@ -232,11 +232,108 @@ export function resolveExtensionPointPattern(
232
232
  return pattern.replace(/\{([^}]+)\}/g, (token, parameterName: string) => parameters[parameterName] ?? token)
233
233
  }
234
234
 
235
+ /**
236
+ * Portable, structural copy of the CLI provenance source reference
237
+ * (`ModuleFactSourceRef` in `packages/cli/.../module-facts.ts`). Redefined here
238
+ * — rather than imported — so `@open-mercato/shared` keeps zero dependency on
239
+ * `@open-mercato/cli`. Field names are kept byte-identical so the two are
240
+ * assignable across the package boundary.
241
+ */
242
+ export type ModuleFactSourceRef = {
243
+ sourcePath: string
244
+ exportName?: string
245
+ line?: number
246
+ }
247
+
248
+ /** Portable, structural copy of the CLI provenance fact reference. */
249
+ export type ModuleFactRef = {
250
+ factSection: string
251
+ factKey: string
252
+ }
253
+
254
+ export type ModuleExtensionContributionKind = ModuleExtensionContributionFact['kind']
255
+
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'
265
+
266
+ 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'
277
+ id: string
278
+ moduleId?: string
279
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
280
+ }
281
+
282
+ export type ModuleExtensionActivation = {
283
+ id: string
284
+ kind: ModuleExtensionActivationKind
285
+ host: ModuleExtensionTargetRef
286
+ contributionKinds: ModuleExtensionContributionKind[]
287
+ phases?: string[]
288
+ /**
289
+ * Mutation operations the call site guards, when statically declared. A
290
+ * contribution declaring only other operations is not bound by this activation.
291
+ */
292
+ operations?: string[]
293
+ source: ModuleFactSourceRef
294
+ bridge?: ModuleFactRef
295
+ }
296
+
297
+ export type ModuleExtensionResolution =
298
+ | 'bound'
299
+ | 'capability-only'
300
+ | 'optional-target-missing'
301
+ | 'wildcard'
302
+ | 'unresolved'
303
+
304
+ export type ModuleIncomingExtensionRef = {
305
+ contributionId: string
306
+ contributionKind: ModuleExtensionContributionKind
307
+ contributorModuleId: string
308
+ target: ModuleExtensionTargetRef
309
+ activationId?: string
310
+ resolution: ModuleExtensionResolution
311
+ source: ModuleFactSourceRef
312
+ }
313
+
314
+ export type ModuleContributionResolution = {
315
+ contributionId: string
316
+ target: ModuleExtensionTargetRef
317
+ resolution: ModuleExtensionResolution
318
+ activationIds: string[]
319
+ }
320
+
321
+ /**
322
+ * Additive, optional bidirectional-topology fields layered on top of the
323
+ * existing extension-surface facts. Every field is optional so legacy consumers
324
+ * and pre-existing generated output remain byte-compatible.
325
+ */
326
+ export type ModuleExtensionSurfaceFactsAdditions = {
327
+ activations?: ModuleExtensionActivation[]
328
+ incoming?: ModuleIncomingExtensionRef[]
329
+ contributionResolutions?: ModuleContributionResolution[]
330
+ }
331
+
235
332
  export type ModuleExtensionSurfaceFacts = {
236
333
  hosts: ModuleExtensionHostFact[]
237
334
  contributions: ModuleExtensionContributionFact[]
238
335
  unresolved: ModuleExtensionUnresolvedFact[]
239
- }
336
+ } & ModuleExtensionSurfaceFactsAdditions
240
337
 
241
338
  export type ModuleExtensionHostFact = {
242
339
  key: string
@@ -390,6 +487,12 @@ export type ModuleExtensionContributionFact = ModuleExtensionContributionBase &
390
487
  audienceScopeContract: string
391
488
  maxPayloadBytes?: number
392
489
  dedupWindowMs?: number
490
+ /**
491
+ * Statically declared handler id. Runtime keys `notifications.handlers`
492
+ * overrides by it, so it is absent when the module declares no id (such a
493
+ * handler cannot be overridden).
494
+ */
495
+ overrideKey?: string
393
496
  }
394
497
  }
395
498
  | {