@open-mercato/cli 0.10.1-develop.7792.1.b0ce6289cf → 0.10.1-develop.7796.1.f2868e5c62

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 (90) hide show
  1. package/dist/agentic/guides/module-facts.json +162 -162
  2. package/dist/agentic/guides/module-facts.v2.json +162 -162
  3. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  4. package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
  5. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  6. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  7. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  8. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  9. package/dist/agentic/guides/modules/auth/index.md +1 -1
  10. package/dist/agentic/guides/modules/availability/index.md +1 -1
  11. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  12. package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
  13. package/dist/agentic/guides/modules/cart/index.md +1 -1
  14. package/dist/agentic/guides/modules/catalog/index.md +1 -1
  15. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  16. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  17. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  18. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  19. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  20. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  21. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  22. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  23. package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
  24. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  25. package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
  26. package/dist/agentic/guides/modules/configs/index.md +1 -1
  27. package/dist/agentic/guides/modules/content/index.md +1 -1
  28. package/dist/agentic/guides/modules/currencies/index.md +1 -1
  29. package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
  30. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  31. package/dist/agentic/guides/modules/customers/index.md +1 -1
  32. package/dist/agentic/guides/modules/dashboards/index.md +1 -1
  33. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  34. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  35. package/dist/agentic/guides/modules/devices/index.md +1 -1
  36. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  37. package/dist/agentic/guides/modules/directory/index.md +1 -1
  38. package/dist/agentic/guides/modules/documents/index.md +1 -1
  39. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  40. package/dist/agentic/guides/modules/entities/index.md +1 -1
  41. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  42. package/dist/agentic/guides/modules/events/index.md +1 -1
  43. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  44. package/dist/agentic/guides/modules/forms/index.md +1 -1
  45. package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
  46. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  47. package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
  48. package/dist/agentic/guides/modules/generators/index.md +1 -1
  49. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  50. package/dist/agentic/guides/modules/integrations/index.md +1 -1
  51. package/dist/agentic/guides/modules/messages/index.md +1 -1
  52. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  53. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  54. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  55. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  56. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  57. package/dist/agentic/guides/modules/planner/index.md +1 -1
  58. package/dist/agentic/guides/modules/portal/index.md +1 -1
  59. package/dist/agentic/guides/modules/progress/index.md +1 -1
  60. package/dist/agentic/guides/modules/promotions/index.md +1 -1
  61. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  62. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  63. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  64. package/dist/agentic/guides/modules/resources/index.md +1 -1
  65. package/dist/agentic/guides/modules/sales/index.md +1 -1
  66. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  67. package/dist/agentic/guides/modules/search/index.md +1 -1
  68. package/dist/agentic/guides/modules/security/index.md +1 -1
  69. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  70. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  71. package/dist/agentic/guides/modules/sso/index.md +1 -1
  72. package/dist/agentic/guides/modules/staff/index.md +1 -1
  73. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  74. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  75. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  76. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  77. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  78. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  79. package/dist/agentic/guides/modules/translations/index.md +1 -1
  80. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  81. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  82. package/dist/agentic/guides/modules/wms/index.md +1 -1
  83. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  84. package/dist/agentic/guides/reference-module-facts.json +1 -1
  85. package/dist/agentic/guides/upstream/manifest.json +1 -1
  86. package/dist/mercato.js +7 -0
  87. package/dist/mercato.js.map +2 -2
  88. package/package.json +7 -7
  89. package/src/__tests__/mercato.test.ts +112 -0
  90. package/src/mercato.ts +23 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/cli",
3
- "version": "0.10.1-develop.7792.1.b0ce6289cf",
3
+ "version": "0.10.1-develop.7796.1.f2868e5c62",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,10 +60,10 @@
60
60
  "@mikro-orm/decorators": "^7.1.14",
61
61
  "@mikro-orm/migrations": "^7.1.14",
62
62
  "@mikro-orm/postgresql": "^7.1.14",
63
- "@open-mercato/events": "0.10.1-develop.7792.1.b0ce6289cf",
64
- "@open-mercato/queue": "0.10.1-develop.7792.1.b0ce6289cf",
65
- "@open-mercato/shared": "0.10.1-develop.7792.1.b0ce6289cf",
66
- "@open-mercato/telemetry": "0.10.1-develop.7792.1.b0ce6289cf",
63
+ "@open-mercato/events": "0.10.1-develop.7796.1.f2868e5c62",
64
+ "@open-mercato/queue": "0.10.1-develop.7796.1.f2868e5c62",
65
+ "@open-mercato/shared": "0.10.1-develop.7796.1.f2868e5c62",
66
+ "@open-mercato/telemetry": "0.10.1-develop.7796.1.f2868e5c62",
67
67
  "cross-spawn": "^7.0.6",
68
68
  "minisearch": "7.2.0",
69
69
  "pg": "8.23.0",
@@ -75,10 +75,10 @@
75
75
  "typescript-js": "npm:typescript@6.0.3"
76
76
  },
77
77
  "peerDependencies": {
78
- "@open-mercato/shared": "0.10.1-develop.7792.1.b0ce6289cf"
78
+ "@open-mercato/shared": "0.10.1-develop.7796.1.f2868e5c62"
79
79
  },
80
80
  "devDependencies": {
81
- "@open-mercato/shared": "0.10.1-develop.7792.1.b0ce6289cf",
81
+ "@open-mercato/shared": "0.10.1-develop.7796.1.f2868e5c62",
82
82
  "@types/jest": "^30.0.0",
83
83
  "jest": "^30.4.2",
84
84
  "ts-jest": "^29.4.12"
@@ -1153,6 +1153,118 @@ describe('init command failure output', () => {
1153
1153
  consoleErrorSpy.mockRestore()
1154
1154
  consoleLogSpy.mockRestore()
1155
1155
  })
1156
+
1157
+ it('derives admin/employee emails from the --email domain, not the acme.com default (#5806)', async () => {
1158
+ const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
1159
+ const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
1160
+
1161
+ delete process.env.OM_INIT_ADMIN_EMAIL
1162
+ delete process.env.OM_INIT_EMPLOYEE_EMAIL
1163
+
1164
+ let adminEmailAtSetupTime: string | undefined
1165
+ let employeeEmailAtSetupTime: string | undefined
1166
+ // Reads OM_INIT_ADMIN_EMAIL/OM_INIT_EMPLOYEE_EMAIL at call time, mirroring what the
1167
+ // real `auth setup` -> setupInitialTenant reads. `runModuleCommand` invokes this
1168
+ // in-process (not spawned), so the env vars `mercato init` sets right before this
1169
+ // call are visible here exactly as they would be for the real command.
1170
+ const authSetup = jest.fn().mockImplementation(async () => {
1171
+ adminEmailAtSetupTime = process.env.OM_INIT_ADMIN_EMAIL
1172
+ employeeEmailAtSetupTime = process.env.OM_INIT_EMPLOYEE_EMAIL
1173
+ })
1174
+ mockInitDependencies({ authSetup })
1175
+
1176
+ const mercato = await import('../mercato')
1177
+ const exitCode = await mercato.run([
1178
+ 'node',
1179
+ 'mercato',
1180
+ 'init',
1181
+ '--email=superadmin@example.org',
1182
+ '--password=Strong-Pa55!!',
1183
+ ])
1184
+
1185
+ expect(exitCode).toBe(0)
1186
+ expect(authSetup).toHaveBeenCalled()
1187
+ expect(adminEmailAtSetupTime).toBe('admin@example.org')
1188
+ expect(employeeEmailAtSetupTime).toBe('employee@example.org')
1189
+
1190
+ delete process.env.OM_INIT_ADMIN_EMAIL
1191
+ delete process.env.OM_INIT_EMPLOYEE_EMAIL
1192
+ consoleErrorSpy.mockRestore()
1193
+ consoleLogSpy.mockRestore()
1194
+ })
1195
+
1196
+ it('does not set OM_INIT_ADMIN_EMAIL when it would equal the superadmin email (#5806)', async () => {
1197
+ const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
1198
+ const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
1199
+
1200
+ delete process.env.OM_INIT_ADMIN_EMAIL
1201
+ delete process.env.OM_INIT_EMPLOYEE_EMAIL
1202
+
1203
+ let adminEmailAtSetupTime: string | undefined
1204
+ let employeeEmailAtSetupTime: string | undefined
1205
+ const authSetup = jest.fn().mockImplementation(async () => {
1206
+ adminEmailAtSetupTime = process.env.OM_INIT_ADMIN_EMAIL
1207
+ employeeEmailAtSetupTime = process.env.OM_INIT_EMPLOYEE_EMAIL
1208
+ })
1209
+ mockInitDependencies({ authSetup })
1210
+
1211
+ const mercato = await import('../mercato')
1212
+ const exitCode = await mercato.run([
1213
+ 'node',
1214
+ 'mercato',
1215
+ 'init',
1216
+ '--email=admin@example.org',
1217
+ '--password=Strong-Pa55!!',
1218
+ ])
1219
+
1220
+ expect(exitCode).toBe(0)
1221
+ expect(authSetup).toHaveBeenCalled()
1222
+ // Derived admin@example.org would collide with the superadmin — leave unset so
1223
+ // deactivateDemoUsersIfSelfOnboardingEnabled cannot lock the primary account out.
1224
+ expect(adminEmailAtSetupTime).toBeUndefined()
1225
+ expect(employeeEmailAtSetupTime).toBe('employee@example.org')
1226
+
1227
+ delete process.env.OM_INIT_ADMIN_EMAIL
1228
+ delete process.env.OM_INIT_EMPLOYEE_EMAIL
1229
+ consoleErrorSpy.mockRestore()
1230
+ consoleLogSpy.mockRestore()
1231
+ })
1232
+
1233
+ it('does not set OM_INIT_*_EMAIL when --no-demo-users is passed (#5806)', async () => {
1234
+ const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
1235
+ const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
1236
+
1237
+ delete process.env.OM_INIT_ADMIN_EMAIL
1238
+ delete process.env.OM_INIT_EMPLOYEE_EMAIL
1239
+
1240
+ let adminEmailAtSetupTime: string | undefined
1241
+ let employeeEmailAtSetupTime: string | undefined
1242
+ const authSetup = jest.fn().mockImplementation(async () => {
1243
+ adminEmailAtSetupTime = process.env.OM_INIT_ADMIN_EMAIL
1244
+ employeeEmailAtSetupTime = process.env.OM_INIT_EMPLOYEE_EMAIL
1245
+ })
1246
+ mockInitDependencies({ authSetup })
1247
+
1248
+ const mercato = await import('../mercato')
1249
+ const exitCode = await mercato.run([
1250
+ 'node',
1251
+ 'mercato',
1252
+ 'init',
1253
+ '--email=superadmin@example.org',
1254
+ '--password=Strong-Pa55!!',
1255
+ '--no-demo-users',
1256
+ ])
1257
+
1258
+ expect(exitCode).toBe(0)
1259
+ expect(authSetup).toHaveBeenCalled()
1260
+ expect(adminEmailAtSetupTime).toBeUndefined()
1261
+ expect(employeeEmailAtSetupTime).toBeUndefined()
1262
+
1263
+ delete process.env.OM_INIT_ADMIN_EMAIL
1264
+ delete process.env.OM_INIT_EMPLOYEE_EMAIL
1265
+ consoleErrorSpy.mockRestore()
1266
+ consoleLogSpy.mockRestore()
1267
+ })
1156
1268
  })
1157
1269
 
1158
1270
  describe('seed:defaults command', () => {
package/src/mercato.ts CHANGED
@@ -1268,6 +1268,29 @@ export async function run(argv = process.argv) {
1268
1268
  if (!skipDemoUsers && employeeEmailDerived && derivedSecrets.employeePassword) {
1269
1269
  process.env.OM_INIT_EMPLOYEE_PASSWORD = derivedSecrets.employeePassword
1270
1270
  }
1271
+ // Symmetrical with the passwords above: setupInitialTenant derives admin/employee
1272
+ // emails from a hardcoded DEFAULT_DERIVED_EMAIL_DOMAIN ('acme.com') when these are
1273
+ // unset, so without this the summary banner (which reads adminEmailDerived/
1274
+ // employeeEmailDerived directly) and the actually-seeded accounts silently disagree
1275
+ // for any --email domain other than acme.com (#5806). Skip when --no-demo-users
1276
+ // (no accounts are created) or when the derived address equals the superadmin's
1277
+ // own email — otherwise deactivateDemoUsersIfSelfOnboardingEnabled would treat
1278
+ // the superadmin as a demo account and lock them out.
1279
+ const primaryEmailLower = email.trim().toLowerCase()
1280
+ if (
1281
+ !skipDemoUsers &&
1282
+ adminEmailDerived &&
1283
+ adminEmailDerived.trim().toLowerCase() !== primaryEmailLower
1284
+ ) {
1285
+ process.env.OM_INIT_ADMIN_EMAIL = adminEmailDerived
1286
+ }
1287
+ if (
1288
+ !skipDemoUsers &&
1289
+ employeeEmailDerived &&
1290
+ employeeEmailDerived.trim().toLowerCase() !== primaryEmailLower
1291
+ ) {
1292
+ process.env.OM_INIT_EMPLOYEE_EMAIL = employeeEmailDerived
1293
+ }
1271
1294
  const roles = findArgValue(['--roles='], 'superadmin,admin,employee')
1272
1295
  const skipPasswordPolicyRaw = initArgs.find((arg) =>
1273
1296
  arg === '--skip-password-policy' ||