@open-mercato/cli 0.6.8-develop.6918.1.7b3f32b0c8 → 0.6.8-develop.6924.1.a8d208fcdc
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/agentic/guides/module-facts.json +112 -112
- package/dist/agentic/guides/modules/ai_assistant.md +1 -1
- package/dist/agentic/guides/modules/api_docs.md +1 -1
- package/dist/agentic/guides/modules/api_keys.md +1 -1
- package/dist/agentic/guides/modules/attachments.md +1 -1
- package/dist/agentic/guides/modules/audit_logs.md +1 -1
- package/dist/agentic/guides/modules/auth.md +1 -1
- package/dist/agentic/guides/modules/business_rules.md +1 -1
- package/dist/agentic/guides/modules/catalog.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail.md +1 -1
- package/dist/agentic/guides/modules/channel_imap.md +1 -1
- package/dist/agentic/guides/modules/checkout.md +1 -1
- package/dist/agentic/guides/modules/communication_channels.md +1 -1
- package/dist/agentic/guides/modules/configs.md +1 -1
- package/dist/agentic/guides/modules/content.md +1 -1
- package/dist/agentic/guides/modules/currencies.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts.md +1 -1
- package/dist/agentic/guides/modules/customers.md +1 -1
- package/dist/agentic/guides/modules/dashboards.md +1 -1
- package/dist/agentic/guides/modules/data_sync.md +1 -1
- package/dist/agentic/guides/modules/design_system.md +1 -1
- package/dist/agentic/guides/modules/dictionaries.md +1 -1
- package/dist/agentic/guides/modules/directory.md +1 -1
- package/dist/agentic/guides/modules/entities.md +1 -1
- package/dist/agentic/guides/modules/events.md +3 -3
- package/dist/agentic/guides/modules/feature_toggles.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe.md +1 -1
- package/dist/agentic/guides/modules/generators.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops.md +1 -1
- package/dist/agentic/guides/modules/integrations.md +1 -1
- package/dist/agentic/guides/modules/messages.md +1 -1
- package/dist/agentic/guides/modules/notifications.md +1 -1
- package/dist/agentic/guides/modules/onboarding.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways.md +1 -1
- package/dist/agentic/guides/modules/perspectives.md +1 -1
- package/dist/agentic/guides/modules/planner.md +1 -1
- package/dist/agentic/guides/modules/portal.md +1 -1
- package/dist/agentic/guides/modules/progress.md +1 -1
- package/dist/agentic/guides/modules/query_index.md +1 -1
- package/dist/agentic/guides/modules/record_locks.md +1 -1
- package/dist/agentic/guides/modules/resources.md +1 -1
- package/dist/agentic/guides/modules/sales.md +1 -1
- package/dist/agentic/guides/modules/scheduler.md +1 -1
- package/dist/agentic/guides/modules/search.md +1 -1
- package/dist/agentic/guides/modules/security.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers.md +1 -1
- package/dist/agentic/guides/modules/sso.md +1 -1
- package/dist/agentic/guides/modules/staff.md +1 -1
- package/dist/agentic/guides/modules/storage_s3.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo.md +1 -1
- package/dist/agentic/guides/modules/sync_excel.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays.md +1 -1
- package/dist/agentic/guides/modules/translations.md +1 -1
- package/dist/agentic/guides/modules/webhooks.md +1 -1
- package/dist/agentic/guides/modules/wms.md +1 -1
- package/dist/agentic/guides/modules/workflows.md +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/agentic/shared/ai/review-checklist.md +1 -1
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +1 -1
- package/dist/lib/events-single-delivery.js +1 -1
- package/dist/lib/events-single-delivery.js.map +2 -2
- package/package.json +6 -6
- package/src/lib/__tests__/events-single-delivery.test.ts +17 -1
- package/src/lib/events-single-delivery.ts +14 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/cli",
|
|
3
|
-
"version": "0.6.8-develop.
|
|
3
|
+
"version": "0.6.8-develop.6924.1.a8d208fcdc",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@mikro-orm/decorators": "^7.1.8",
|
|
61
61
|
"@mikro-orm/migrations": "^7.1.8",
|
|
62
62
|
"@mikro-orm/postgresql": "^7.1.8",
|
|
63
|
-
"@open-mercato/queue": "0.6.8-develop.
|
|
64
|
-
"@open-mercato/shared": "0.6.8-develop.
|
|
65
|
-
"@open-mercato/telemetry": "0.6.8-develop.
|
|
63
|
+
"@open-mercato/queue": "0.6.8-develop.6924.1.a8d208fcdc",
|
|
64
|
+
"@open-mercato/shared": "0.6.8-develop.6924.1.a8d208fcdc",
|
|
65
|
+
"@open-mercato/telemetry": "0.6.8-develop.6924.1.a8d208fcdc",
|
|
66
66
|
"cross-spawn": "^7.0.6",
|
|
67
67
|
"pg": "8.22.0",
|
|
68
68
|
"semver": "^7.8.5",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"typescript-js": "npm:typescript@6.0.3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@open-mercato/shared": "0.6.8-develop.
|
|
76
|
+
"@open-mercato/shared": "0.6.8-develop.6924.1.a8d208fcdc"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@open-mercato/shared": "0.6.8-develop.
|
|
79
|
+
"@open-mercato/shared": "0.6.8-develop.6924.1.a8d208fcdc",
|
|
80
80
|
"@types/jest": "^30.0.0",
|
|
81
81
|
"jest": "^30.4.2",
|
|
82
82
|
"ts-jest": "^29.4.12"
|
|
@@ -9,7 +9,7 @@ describe('reconcileEventsSingleDelivery', () => {
|
|
|
9
9
|
expect(reconcileEventsSingleDelivery({}, 'lazy')).toEqual({ effective: true })
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
-
it('falls back to inline
|
|
12
|
+
it('falls back to inline delivery (with a warning) when no worker runs', () => {
|
|
13
13
|
const result = reconcileEventsSingleDelivery({}, 'off')
|
|
14
14
|
expect(result.effective).toBe(false)
|
|
15
15
|
expect(result.warning).toContain('OM_EVENTS_SINGLE_DELIVERY')
|
|
@@ -65,4 +65,20 @@ describe('applyEventsSingleDeliveryGuard', () => {
|
|
|
65
65
|
expect(errorSpy).not.toHaveBeenCalled()
|
|
66
66
|
errorSpy.mockRestore()
|
|
67
67
|
})
|
|
68
|
+
|
|
69
|
+
// The written value is what the spawned children actually consume: the guard
|
|
70
|
+
// copies it into the child `runtimeEnv`, so a Next.js or worker process started
|
|
71
|
+
// by `mercato server` reads this explicit token instead of re-deriving the
|
|
72
|
+
// default. An empty or non-boolean value would silently hand children the
|
|
73
|
+
// default-on behaviour the guard just decided against, so pin the token here.
|
|
74
|
+
it('writes an explicit boolean token into the env handed to spawned children', () => {
|
|
75
|
+
const processEnv: NodeJS.ProcessEnv = {}
|
|
76
|
+
const runtimeEnv: NodeJS.ProcessEnv = {}
|
|
77
|
+
|
|
78
|
+
applyEventsSingleDeliveryGuard({ processEnv, runtimeEnv, autoSpawnWorkersMode: 'lazy' })
|
|
79
|
+
|
|
80
|
+
for (const value of [processEnv.OM_EVENTS_SINGLE_DELIVERY, runtimeEnv.OM_EVENTS_SINGLE_DELIVERY]) {
|
|
81
|
+
expect(['1', 'true', 'yes', 'on']).toContain(value)
|
|
82
|
+
}
|
|
83
|
+
})
|
|
68
84
|
})
|
|
@@ -5,6 +5,14 @@ import type { AutoSpawnWorkersMode } from './auto-spawn-workers'
|
|
|
5
5
|
// `@open-mercato/events/single-delivery`. The CLI cannot import the events
|
|
6
6
|
// package (no dependency edge), so the reconcile logic is mirrored here for the
|
|
7
7
|
// server-bootstrap guard only; the bus and worker own the runtime behavior.
|
|
8
|
+
//
|
|
9
|
+
// This guard is the ONLY place that reconciles the flag against worker
|
|
10
|
+
// availability. The event bus deliberately does not: the queue is durable, so a
|
|
11
|
+
// persistent emit with no worker yet is delayed rather than lost, and delivering
|
|
12
|
+
// inline instead would move the work onto the caller's request path. Only this
|
|
13
|
+
// bootstrap knows for a fact that the process it is launching runs no worker, so
|
|
14
|
+
// only it rewrites the value - into both envs below, so the app and any spawned
|
|
15
|
+
// child agree.
|
|
8
16
|
const EVENTS_SINGLE_DELIVERY_ENV = 'OM_EVENTS_SINGLE_DELIVERY'
|
|
9
17
|
const EVENTS_EXTERNAL_WORKER_ENV = 'OM_EVENTS_EXTERNAL_WORKER'
|
|
10
18
|
|
|
@@ -23,7 +31,8 @@ export type SingleDeliveryReconciliation = {
|
|
|
23
31
|
* (auto-spawn off and no acknowledged external worker) would skip those
|
|
24
32
|
* subscribers with nothing to drain the queue — silently dropping notifications,
|
|
25
33
|
* queued emails, and indexing. This fails safe by disabling single-delivery for
|
|
26
|
-
* such a process (
|
|
34
|
+
* such a process (persistent subscribers run inline instead) and returning a loud
|
|
35
|
+
* warning. The bus stamps the queued job, so the inline run stays exactly-once.
|
|
27
36
|
*
|
|
28
37
|
* Transient worker downtime is NOT this guard's concern: the durable queue holds
|
|
29
38
|
* the job until a worker returns. Only the "no worker at all" config is guarded.
|
|
@@ -43,9 +52,10 @@ export function reconcileEventsSingleDelivery(
|
|
|
43
52
|
`[events] ${EVENTS_SINGLE_DELIVERY_ENV} is on (default) but this process auto-spawns no events worker ` +
|
|
44
53
|
`(AUTO_SPAWN_WORKERS=off) and ${EVENTS_EXTERNAL_WORKER_ENV} is not set. Persistent subscribers would be ` +
|
|
45
54
|
`skipped inline with nothing to drain the queue, silently dropping notifications, queued emails, and ` +
|
|
46
|
-
`indexing.
|
|
47
|
-
`worker
|
|
48
|
-
`
|
|
55
|
+
`indexing. Running them inline instead, on the caller's request path. Delivery stays exactly-once: the ` +
|
|
56
|
+
`queued job is stamped so an events worker that does drain the queue skips it. To move this work off the ` +
|
|
57
|
+
`request path, run an events worker (\`mercato queue worker events\`) and set ` +
|
|
58
|
+
`${EVENTS_EXTERNAL_WORKER_ENV}=true, or enable AUTO_SPAWN_WORKERS.`,
|
|
49
59
|
}
|
|
50
60
|
}
|
|
51
61
|
|