@open-mercato/channel-smtp 0.11.1-develop.8417.1.36c73b01e6 → 0.11.1-develop.8418.1.8ddb502575
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,3 +1,5 @@
|
|
|
1
|
+
import { validateAdapterCapabilities } from "@open-mercato/core/modules/communication_channels/lib/adapter-compat";
|
|
2
|
+
import { defineProcessDiRegistrar, registerProcessActivation } from "@open-mercato/shared/lib/di/process-registrar";
|
|
1
3
|
import { asValue } from "awilix";
|
|
2
4
|
import {
|
|
3
5
|
hasChannelAdapter,
|
|
@@ -6,16 +8,28 @@ import {
|
|
|
6
8
|
import { getSmtpChannelAdapter } from "./lib/adapter.js";
|
|
7
9
|
import { registerSmtpSystemEmailConfigResolver } from "./lib/system-email-config.js";
|
|
8
10
|
import { channelSmtpHealthCheck } from "./lib/health.js";
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
function registerWithActivation(container, activate) {
|
|
12
|
+
activate(() => {
|
|
13
|
+
registerSmtpSystemEmailConfigResolver();
|
|
14
|
+
});
|
|
15
|
+
activate(() => {
|
|
16
|
+
if (!hasChannelAdapter("smtp")) {
|
|
17
|
+
registerChannelAdapter(getSmtpChannelAdapter());
|
|
18
|
+
}
|
|
19
|
+
}, () => {
|
|
20
|
+
if (!hasChannelAdapter("smtp")) validateAdapterCapabilities(getSmtpChannelAdapter());
|
|
21
|
+
});
|
|
14
22
|
container.register({
|
|
15
23
|
channelSmtpAdapter: asValue(getSmtpChannelAdapter()),
|
|
16
24
|
channelSmtpHealthCheck: asValue(channelSmtpHealthCheck)
|
|
17
25
|
});
|
|
18
26
|
}
|
|
27
|
+
function register(container) {
|
|
28
|
+
registerWithActivation(container, (activate) => activate());
|
|
29
|
+
}
|
|
30
|
+
defineProcessDiRegistrar((container) => {
|
|
31
|
+
registerWithActivation(container, (activate, validate) => registerProcessActivation(container, activate, validate));
|
|
32
|
+
}, { legacy: register });
|
|
19
33
|
export {
|
|
20
34
|
register
|
|
21
35
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/modules/channel_smtp/di.ts"],
|
|
4
|
-
"sourcesContent": ["import { asValue } from 'awilix'\nimport type { AppContainer } from '@open-mercato/shared/lib/di/container'\nimport {\n hasChannelAdapter,\n registerChannelAdapter,\n} from '@open-mercato/core/modules/communication_channels/lib/adapter-registry-singleton'\nimport { getSmtpChannelAdapter } from './lib/adapter'\nimport { registerSmtpSystemEmailConfigResolver } from './lib/system-email-config'\nimport { channelSmtpHealthCheck } from './lib/health'\n\
|
|
5
|
-
"mappings": "AAAA,SAAS,eAAe;AAExB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,6CAA6C;AACtD,SAAS,8BAA8B;
|
|
4
|
+
"sourcesContent": ["import { validateAdapterCapabilities } from '@open-mercato/core/modules/communication_channels/lib/adapter-compat'\nimport { defineProcessDiRegistrar, registerProcessActivation } from '@open-mercato/shared/lib/di/process-registrar'\nimport { asValue } from 'awilix'\nimport type { AppContainer } from '@open-mercato/shared/lib/di/container'\nimport {\n hasChannelAdapter,\n registerChannelAdapter,\n} from '@open-mercato/core/modules/communication_channels/lib/adapter-registry-singleton'\nimport { getSmtpChannelAdapter } from './lib/adapter'\nimport { registerSmtpSystemEmailConfigResolver } from './lib/system-email-config'\nimport { channelSmtpHealthCheck } from './lib/health'\n\nfunction registerWithActivation(container: AppContainer, activate: (callback: () => void, validate?: () => void) => void) {\n activate(() => {\n registerSmtpSystemEmailConfigResolver()\n })\n activate(() => {\n if (!hasChannelAdapter('smtp')) {\n registerChannelAdapter(getSmtpChannelAdapter())\n }\n }, () => {\n if (!hasChannelAdapter('smtp')) validateAdapterCapabilities(getSmtpChannelAdapter())\n })\n container.register({\n channelSmtpAdapter: asValue(getSmtpChannelAdapter()),\n channelSmtpHealthCheck: asValue(channelSmtpHealthCheck),\n })\n}\n\nexport function register(container: AppContainer): void {\n registerWithActivation(container, (activate) => activate())\n}\n\ndefineProcessDiRegistrar((container: AppContainer) => {\n registerWithActivation(container, (activate, validate) => registerProcessActivation(container, activate, validate))\n}, { legacy: register })\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mCAAmC;AAC5C,SAAS,0BAA0B,iCAAiC;AACpE,SAAS,eAAe;AAExB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,6CAA6C;AACtD,SAAS,8BAA8B;AAEvC,SAAS,uBAAuB,WAAyB,UAAiE;AACxH,WAAS,MAAM;AACb,0CAAsC;AAAA,EACxC,CAAC;AACD,WAAS,MAAM;AACb,QAAI,CAAC,kBAAkB,MAAM,GAAG;AAC9B,6BAAuB,sBAAsB,CAAC;AAAA,IAChD;AAAA,EACF,GAAG,MAAM;AACP,QAAI,CAAC,kBAAkB,MAAM,EAAG,6BAA4B,sBAAsB,CAAC;AAAA,EACrF,CAAC;AACD,YAAU,SAAS;AAAA,IACjB,oBAAoB,QAAQ,sBAAsB,CAAC;AAAA,IACnD,wBAAwB,QAAQ,sBAAsB;AAAA,EACxD,CAAC;AACH;AAEO,SAAS,SAAS,WAA+B;AACtD,yBAAuB,WAAW,CAAC,aAAa,SAAS,CAAC;AAC5D;AAEA,yBAAyB,CAAC,cAA4B;AACpD,yBAAuB,WAAW,CAAC,UAAU,aAAa,0BAA0B,WAAW,UAAU,QAAQ,CAAC;AACpH,GAAG,EAAE,QAAQ,SAAS,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/channel-smtp",
|
|
3
|
-
"version": "0.11.1-develop.
|
|
3
|
+
"version": "0.11.1-develop.8418.1.8ddb502575",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,22 +50,22 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@open-mercato/core": "0.11.1-develop.
|
|
53
|
+
"@open-mercato/core": "0.11.1-develop.8418.1.8ddb502575",
|
|
54
54
|
"@types/nodemailer": "^8.0.1",
|
|
55
55
|
"nodemailer": "^10.0.10"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@mikro-orm/postgresql": "^7.0.14",
|
|
59
|
-
"@open-mercato/ai-assistant": "0.11.1-develop.
|
|
60
|
-
"@open-mercato/shared": "0.11.1-develop.
|
|
61
|
-
"@open-mercato/ui": "0.11.1-develop.
|
|
59
|
+
"@open-mercato/ai-assistant": "0.11.1-develop.8418.1.8ddb502575",
|
|
60
|
+
"@open-mercato/shared": "0.11.1-develop.8418.1.8ddb502575",
|
|
61
|
+
"@open-mercato/ui": "0.11.1-develop.8418.1.8ddb502575",
|
|
62
62
|
"react": "^19.0.0",
|
|
63
63
|
"react-dom": "^19.0.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@open-mercato/ai-assistant": "0.11.1-develop.
|
|
67
|
-
"@open-mercato/shared": "0.11.1-develop.
|
|
68
|
-
"@open-mercato/ui": "0.11.1-develop.
|
|
66
|
+
"@open-mercato/ai-assistant": "0.11.1-develop.8418.1.8ddb502575",
|
|
67
|
+
"@open-mercato/shared": "0.11.1-develop.8418.1.8ddb502575",
|
|
68
|
+
"@open-mercato/ui": "0.11.1-develop.8418.1.8ddb502575",
|
|
69
69
|
"@types/jest": "^30.0.0",
|
|
70
70
|
"@types/react": "^19.2.18",
|
|
71
71
|
"@types/react-dom": "^19.2.5",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createContainer } from 'awilix'
|
|
2
|
+
import { getProcessDiRegistrar, runProcessActivations } from '@open-mercato/shared/lib/di/process-registrar'
|
|
3
|
+
import { hasChannelAdapter } from '@open-mercato/core/modules/communication_channels/lib/adapter-registry-singleton'
|
|
4
|
+
import { registerSmtpSystemEmailConfigResolver } from '../lib/system-email-config'
|
|
5
|
+
import { register } from '../di'
|
|
6
|
+
|
|
7
|
+
jest.mock('../lib/adapter', () => ({
|
|
8
|
+
getSmtpChannelAdapter: () => ({
|
|
9
|
+
providerKey: 'smtp', channelType: 'email', capabilities: { reactions: true },
|
|
10
|
+
}),
|
|
11
|
+
}))
|
|
12
|
+
jest.mock('../lib/system-email-config', () => ({ registerSmtpSystemEmailConfigResolver: jest.fn() }))
|
|
13
|
+
jest.mock('../lib/health', () => ({ channelSmtpHealthCheck: jest.fn() }))
|
|
14
|
+
|
|
15
|
+
test('rejects invalid channel capabilities before publishing the system email resolver', () => {
|
|
16
|
+
const registryKey = Symbol.for('@open-mercato/communication-channels/adapter-registry')
|
|
17
|
+
const host = globalThis as unknown as Record<symbol, unknown>
|
|
18
|
+
const previous = host[registryKey]
|
|
19
|
+
delete host[registryKey]
|
|
20
|
+
try {
|
|
21
|
+
const root = createContainer()
|
|
22
|
+
getProcessDiRegistrar(register)!(root)
|
|
23
|
+
expect(() => runProcessActivations(root)).toThrow('does not implement sendReaction')
|
|
24
|
+
expect(registerSmtpSystemEmailConfigResolver).not.toHaveBeenCalled()
|
|
25
|
+
expect(hasChannelAdapter('smtp')).toBe(false)
|
|
26
|
+
} finally {
|
|
27
|
+
if (previous === undefined) delete host[registryKey]
|
|
28
|
+
else host[registryKey] = previous
|
|
29
|
+
}
|
|
30
|
+
})
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { validateAdapterCapabilities } from '@open-mercato/core/modules/communication_channels/lib/adapter-compat'
|
|
2
|
+
import { defineProcessDiRegistrar, registerProcessActivation } from '@open-mercato/shared/lib/di/process-registrar'
|
|
1
3
|
import { asValue } from 'awilix'
|
|
2
4
|
import type { AppContainer } from '@open-mercato/shared/lib/di/container'
|
|
3
5
|
import {
|
|
@@ -8,13 +10,27 @@ import { getSmtpChannelAdapter } from './lib/adapter'
|
|
|
8
10
|
import { registerSmtpSystemEmailConfigResolver } from './lib/system-email-config'
|
|
9
11
|
import { channelSmtpHealthCheck } from './lib/health'
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function registerWithActivation(container: AppContainer, activate: (callback: () => void, validate?: () => void) => void) {
|
|
14
|
+
activate(() => {
|
|
15
|
+
registerSmtpSystemEmailConfigResolver()
|
|
16
|
+
})
|
|
17
|
+
activate(() => {
|
|
18
|
+
if (!hasChannelAdapter('smtp')) {
|
|
19
|
+
registerChannelAdapter(getSmtpChannelAdapter())
|
|
20
|
+
}
|
|
21
|
+
}, () => {
|
|
22
|
+
if (!hasChannelAdapter('smtp')) validateAdapterCapabilities(getSmtpChannelAdapter())
|
|
23
|
+
})
|
|
16
24
|
container.register({
|
|
17
25
|
channelSmtpAdapter: asValue(getSmtpChannelAdapter()),
|
|
18
26
|
channelSmtpHealthCheck: asValue(channelSmtpHealthCheck),
|
|
19
27
|
})
|
|
20
28
|
}
|
|
29
|
+
|
|
30
|
+
export function register(container: AppContainer): void {
|
|
31
|
+
registerWithActivation(container, (activate) => activate())
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
defineProcessDiRegistrar((container: AppContainer) => {
|
|
35
|
+
registerWithActivation(container, (activate, validate) => registerProcessActivation(container, activate, validate))
|
|
36
|
+
}, { legacy: register })
|