@open-mercato/webhooks 0.6.7-develop.6862.1.c11a64ce0a → 0.6.7

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 (65) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/webhooks/__integration__/TC-WEBHOOK-003.spec.js +0 -15
  3. package/dist/modules/webhooks/__integration__/TC-WEBHOOK-003.spec.js.map +2 -2
  4. package/dist/modules/webhooks/api/inbound/[endpointId]/route.js +7 -152
  5. package/dist/modules/webhooks/api/inbound/[endpointId]/route.js.map +3 -3
  6. package/dist/modules/webhooks/backend/webhooks/[id]/page.js +1 -2
  7. package/dist/modules/webhooks/backend/webhooks/[id]/page.js.map +2 -2
  8. package/dist/modules/webhooks/backend/webhooks/page.js +1 -2
  9. package/dist/modules/webhooks/backend/webhooks/page.js.map +2 -2
  10. package/dist/modules/webhooks/data/entities.js +1 -101
  11. package/dist/modules/webhooks/data/entities.js.map +2 -2
  12. package/dist/modules/webhooks/encryption.js +0 -7
  13. package/dist/modules/webhooks/encryption.js.map +2 -2
  14. package/dist/modules/webhooks/events.js +0 -2
  15. package/dist/modules/webhooks/events.js.map +2 -2
  16. package/dist/modules/webhooks/lib/queue.js +0 -47
  17. package/dist/modules/webhooks/lib/queue.js.map +2 -2
  18. package/dist/modules/webhooks/widgets/injection/integration-deliveries/widget.client.js +1 -2
  19. package/dist/modules/webhooks/widgets/injection/integration-deliveries/widget.client.js.map +2 -2
  20. package/generated/entities.ids.generated.ts +1 -3
  21. package/generated/entity-fields-registry.ts +0 -28
  22. package/package.json +11 -12
  23. package/src/modules/webhooks/__integration__/TC-WEBHOOK-003.spec.ts +0 -16
  24. package/src/modules/webhooks/api/inbound/[endpointId]/__tests__/route.test.ts +1 -99
  25. package/src/modules/webhooks/api/inbound/[endpointId]/route.ts +7 -178
  26. package/src/modules/webhooks/backend/webhooks/[id]/page.tsx +1 -2
  27. package/src/modules/webhooks/backend/webhooks/page.tsx +1 -2
  28. package/src/modules/webhooks/data/entities.ts +0 -84
  29. package/src/modules/webhooks/encryption.ts +0 -7
  30. package/src/modules/webhooks/events.ts +0 -2
  31. package/src/modules/webhooks/i18n/de.json +1 -1
  32. package/src/modules/webhooks/i18n/en.json +1 -1
  33. package/src/modules/webhooks/i18n/es.json +1 -1
  34. package/src/modules/webhooks/i18n/pl.json +1 -1
  35. package/src/modules/webhooks/lib/queue.ts +0 -60
  36. package/src/modules/webhooks/migrations/.snapshot-open-mercato.json +339 -908
  37. package/src/modules/webhooks/widgets/injection/integration-deliveries/widget.client.tsx +1 -2
  38. package/dist/modules/webhooks/extension-points.js +0 -15
  39. package/dist/modules/webhooks/extension-points.js.map +0 -7
  40. package/dist/modules/webhooks/generators.js +0 -57
  41. package/dist/modules/webhooks/generators.js.map +0 -7
  42. package/dist/modules/webhooks/lib/inbound-dispatch.js +0 -105
  43. package/dist/modules/webhooks/lib/inbound-dispatch.js.map +0 -7
  44. package/dist/modules/webhooks/lib/inbound-registry.js +0 -76
  45. package/dist/modules/webhooks/lib/inbound-registry.js.map +0 -7
  46. package/dist/modules/webhooks/lib/module-webhook-registry.js +0 -12
  47. package/dist/modules/webhooks/lib/module-webhook-registry.js.map +0 -7
  48. package/dist/modules/webhooks/migrations/Migration20260617141327_webhooks.js +0 -16
  49. package/dist/modules/webhooks/migrations/Migration20260617141327_webhooks.js.map +0 -7
  50. package/dist/modules/webhooks/workers/inbound-dispatch.js +0 -29
  51. package/dist/modules/webhooks/workers/inbound-dispatch.js.map +0 -7
  52. package/generated/entities/inbound_endpoint_config_entity/index.ts +0 -8
  53. package/generated/entities/webhook_ingestion_entity/index.ts +0 -16
  54. package/src/modules/webhooks/api/inbound/[endpointId]/__tests__/route.unify.test.ts +0 -149
  55. package/src/modules/webhooks/extension-points.ts +0 -12
  56. package/src/modules/webhooks/generators.ts +0 -57
  57. package/src/modules/webhooks/i18n/ko.json +0 -161
  58. package/src/modules/webhooks/lib/__tests__/inbound-dispatch.test.ts +0 -186
  59. package/src/modules/webhooks/lib/__tests__/inbound-registry.test.ts +0 -102
  60. package/src/modules/webhooks/lib/__tests__/module-webhook-registry.test.ts +0 -53
  61. package/src/modules/webhooks/lib/inbound-dispatch.ts +0 -147
  62. package/src/modules/webhooks/lib/inbound-registry.ts +0 -92
  63. package/src/modules/webhooks/lib/module-webhook-registry.ts +0 -33
  64. package/src/modules/webhooks/migrations/Migration20260617141327_webhooks.ts +0 -16
  65. package/src/modules/webhooks/workers/inbound-dispatch.ts +0 -31
@@ -2,17 +2,13 @@ import type { EntityManager } from '@mikro-orm/postgresql'
2
2
  import { createModuleQueue, type Queue } from '@open-mercato/queue'
3
3
  import { createLogger } from '@open-mercato/shared/lib/logger'
4
4
  import type { WebhookDeliveryJob } from './delivery'
5
- import type { InboundDispatchJob } from './inbound-dispatch'
6
5
 
7
6
  const logger = createLogger('webhooks')
8
7
 
9
8
  const queues = new Map<string, Queue<WebhookDeliveryJob>>()
10
- const inboundQueues = new Map<string, Queue<InboundDispatchJob>>()
11
9
  const LOCAL_WORKER_PROMISE_KEY = '__openMercatoWebhookLocalWorkerPromise__'
12
- const LOCAL_INBOUND_WORKER_PROMISE_KEY = '__openMercatoWebhookLocalInboundWorkerPromise__'
13
10
 
14
11
  export const WEBHOOK_DELIVERIES_QUEUE = 'webhook-deliveries'
15
- export const WEBHOOK_INBOUND_DISPATCH_QUEUE = 'webhook-inbound-dispatch'
16
12
 
17
13
  export function getWebhookQueue(queueName: string = WEBHOOK_DELIVERIES_QUEUE): Queue<WebhookDeliveryJob> {
18
14
  const existing = queues.get(queueName)
@@ -65,59 +61,3 @@ export async function enqueueWebhookDelivery(job: WebhookDeliveryJob, delayMs?:
65
61
  await ensureLocalWebhookQueueWorkerStarted()
66
62
  return jobId
67
63
  }
68
-
69
- export function getInboundDispatchQueue(
70
- queueName: string = WEBHOOK_INBOUND_DISPATCH_QUEUE,
71
- ): Queue<InboundDispatchJob> {
72
- const existing = inboundQueues.get(queueName)
73
- if (existing) return existing
74
-
75
- const concurrency = Math.max(1, Number.parseInt(process.env.WEBHOOK_INBOUND_QUEUE_CONCURRENCY ?? '5', 10) || 5)
76
- const created = createModuleQueue<InboundDispatchJob>(queueName, { concurrency })
77
-
78
- inboundQueues.set(queueName, created)
79
- return created
80
- }
81
-
82
- async function ensureLocalInboundQueueWorkerStarted(): Promise<void> {
83
- if (process.env.QUEUE_STRATEGY === 'async') return
84
-
85
- const globalStore = globalThis as typeof globalThis & {
86
- [LOCAL_INBOUND_WORKER_PROMISE_KEY]?: Promise<void>
87
- }
88
-
89
- if (globalStore[LOCAL_INBOUND_WORKER_PROMISE_KEY]) {
90
- await globalStore[LOCAL_INBOUND_WORKER_PROMISE_KEY]
91
- return
92
- }
93
-
94
- globalStore[LOCAL_INBOUND_WORKER_PROMISE_KEY] = (async () => {
95
- const queue = getInboundDispatchQueue()
96
-
97
- await queue.process(async (job) => {
98
- const [{ createRequestContainer }, { processInboundDispatchJob }] = await Promise.all([
99
- import('@open-mercato/shared/lib/di/container'),
100
- import('./inbound-dispatch'),
101
- ])
102
-
103
- const container = await createRequestContainer()
104
- const em = (container.resolve('em') as EntityManager).fork()
105
- await processInboundDispatchJob(em, job.payload, {
106
- resolve: <T,>(name: string) => container.resolve(name) as T,
107
- })
108
- })
109
- })().catch((error) => {
110
- delete globalStore[LOCAL_INBOUND_WORKER_PROMISE_KEY]
111
- logger.error('Failed to start local inbound dispatch worker', { err: error })
112
- throw error
113
- })
114
-
115
- await globalStore[LOCAL_INBOUND_WORKER_PROMISE_KEY]
116
- }
117
-
118
- export async function enqueueInboundDispatch(job: InboundDispatchJob): Promise<string> {
119
- const queue = getInboundDispatchQueue()
120
- const jobId = await queue.enqueue(job)
121
- await ensureLocalInboundQueueWorkerStarted()
122
- return jobId
123
- }