@privateaim/messenger-kit 0.7.11 → 0.7.13
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/CHANGELOG.md +44 -0
- package/dist/index.cjs +2 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.13](https://github.com/PrivateAIM/hub/compare/v0.7.12...v0.7.13) (2025-04-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* realtime library/service split ([#474](https://github.com/PrivateAIM/hub/issues/474)) ([43c2dfa](https://github.com/PrivateAIM/hub/commit/43c2dfad654cc61ca9784914cbad56c684434088))
|
|
9
|
+
* validate client-to-server messaging message ([a37cbc4](https://github.com/PrivateAIM/hub/commit/a37cbc4582ac66190aa4aad9a78aca58d34526f4))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **deps:** bump the minorandpatch group across 1 directory with 4 updates ([#1036](https://github.com/PrivateAIM/hub/issues/1036)) ([e52ea50](https://github.com/PrivateAIM/hub/commit/e52ea50288486db487ce0c5f4d2cd0b027c18861))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dependencies
|
|
18
|
+
|
|
19
|
+
* The following workspace dependencies were updated
|
|
20
|
+
* devDependencies
|
|
21
|
+
* @privateaim/core-kit bumped from ^0.8.11 to ^0.8.12
|
|
22
|
+
* peerDependencies
|
|
23
|
+
* @privateaim/core-kit bumped from ^0.8.11 to ^0.8.12
|
|
24
|
+
|
|
25
|
+
## [0.7.12](https://github.com/PrivateAIM/hub/compare/v0.7.11...v0.7.12) (2025-04-24)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* realtime library/service split ([#474](https://github.com/PrivateAIM/hub/issues/474)) ([43c2dfa](https://github.com/PrivateAIM/hub/commit/43c2dfad654cc61ca9784914cbad56c684434088))
|
|
31
|
+
* validate client-to-server messaging message ([a37cbc4](https://github.com/PrivateAIM/hub/commit/a37cbc4582ac66190aa4aad9a78aca58d34526f4))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* **deps:** bump the minorandpatch group across 1 directory with 4 updates ([#1036](https://github.com/PrivateAIM/hub/issues/1036)) ([e52ea50](https://github.com/PrivateAIM/hub/commit/e52ea50288486db487ce0c5f4d2cd0b027c18861))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* devDependencies
|
|
43
|
+
* @privateaim/core-kit bumped from ^0.8.10 to ^0.8.11
|
|
44
|
+
* peerDependencies
|
|
45
|
+
* @privateaim/core-kit bumped from ^0.8.10 to ^0.8.11
|
|
46
|
+
|
|
3
47
|
## [0.7.11](https://github.com/PrivateAIM/hub/compare/v0.7.10...v0.7.11) (2025-04-23)
|
|
4
48
|
|
|
5
49
|
|
package/dist/index.cjs
CHANGED
|
@@ -92,19 +92,14 @@ class CTSMessagingMessageValidator extends validup.Container {
|
|
|
92
92
|
this.mount('data', adapterZod.createValidator(zod.z.object({}).passthrough().or(zod.z.string()).or(zod.z.null()).or(zod.z.undefined()).optional()));
|
|
93
93
|
this.mount('metadata', adapterZod.createValidator(zod.z.object({}).passthrough().or(zod.z.null()).or(zod.z.undefined()).optional()));
|
|
94
94
|
const partyValidator = new CTSMessagingPartyValidator();
|
|
95
|
-
this.mount('to',
|
|
96
|
-
var _ref = _async_to_generator(function*(ctx) {
|
|
95
|
+
this.mount('to', (ctx)=>/*#__PURE__*/ _async_to_generator(function*() {
|
|
97
96
|
const validator = adapterZod.createValidator(zod.z.array(zod.z.object({}).passthrough()));
|
|
98
97
|
const output = yield validator(ctx);
|
|
99
98
|
return Promise.all(output.map((el)=>partyValidator.run(el, {
|
|
100
99
|
path: ctx.pathAbsolute,
|
|
101
100
|
group: ctx.group
|
|
102
101
|
})));
|
|
103
|
-
});
|
|
104
|
-
return function(ctx) {
|
|
105
|
-
return _ref.apply(this, arguments);
|
|
106
|
-
};
|
|
107
|
-
}());
|
|
102
|
+
})());
|
|
108
103
|
}
|
|
109
104
|
}
|
|
110
105
|
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/connection/constants.ts","../src/messaging/constants.ts","../src/messaging/validators/to.ts","../src/messaging/validators/message.ts","../src/utils.ts"],"sourcesContent":["/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum STCConnectionEventName {\n USER_CONNECTED = 'userConnected',\n USER_DISCONNECTED = 'userDisconnected',\n\n ROBOT_CONNECTED = 'robotConnected',\n ROBOT_DISCONNECTED = 'robotDisconnected',\n}\n\nexport enum CTSConnectionEventName {\n USER_CONNECTIONS = 'userConnections',\n USER_CONNECTION_SUBSCRIBE = 'userConnectionSubscribe',\n USER_CONNECTION_UNSUBSCRIBE = 'userConnectionUnsubscribe',\n\n ROBOT_CONNECTIONS = 'robotConnections',\n ROBOT_CONNECTION_SUBSCRIBE = 'robotConnectionSubscribe',\n ROBOT_CONNECTION_UNSUBSCRIBE = 'robotConnectionUnsubscribe',\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum STCMessagingEventName {\n SEND = 'send',\n}\n\nexport enum CTSMessagingEventName {\n SEND = 'send',\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { z } from 'zod';\nimport { createValidator } from '@validup/adapter-zod';\nimport { Container } from 'validup';\nimport type { CTSMessagingParty } from '../types';\n\nexport class CTSMessagingPartyValidator extends Container<CTSMessagingParty> {\n protected initialize() {\n super.initialize();\n\n this.mount(\n 'id',\n createValidator(\n z.string().uuid(),\n ),\n );\n\n this.mount(\n 'type',\n createValidator(\n z.enum(['user', 'robot', 'client']),\n ),\n );\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { z } from 'zod';\nimport { createValidator } from '@validup/adapter-zod';\nimport { Container } from 'validup';\nimport type { CTSMessagingMessage } from '../types';\nimport { CTSMessagingPartyValidator } from './to';\n\nexport class CTSMessagingMessageValidator extends Container<CTSMessagingMessage> {\n protected initialize() {\n super.initialize();\n\n this.mount(\n 'data',\n createValidator(\n z.object({})\n .passthrough()\n .or(z.string())\n .or(z.null())\n .or(z.undefined())\n .optional(),\n ),\n );\n\n this.mount(\n 'metadata',\n createValidator(\n z.object({}).passthrough()\n .or(z.null())\n .or(z.undefined())\n .optional(),\n ),\n );\n\n const partyValidator = new CTSMessagingPartyValidator();\n\n this.mount('to', async (ctx) => {\n const validator = createValidator(\n z.array(z.object({}).passthrough()),\n );\n\n const output = (await validator(ctx)) as unknown[];\n return Promise.all(output.map((el) => partyValidator.run(el, {\n path: ctx.pathAbsolute,\n group: ctx.group,\n })));\n });\n }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { EventCallback } from './types';\n\nexport function isEventCallback(\n input: unknown,\n fnArgs?: number,\n) : input is EventCallback {\n if (typeof fnArgs === 'undefined') {\n return typeof input === 'function';\n }\n\n return typeof input === 'function' &&\n input.length >= fnArgs;\n}\n\nexport function isEventTarget(\n input: unknown,\n) : input is EventTarget {\n return typeof input === 'number' ||\n typeof input === 'string' ||\n typeof input === 'undefined';\n}\n"],"names":["STCConnectionEventName","CTSConnectionEventName","STCMessagingEventName","CTSMessagingEventName","CTSMessagingPartyValidator","Container","initialize","mount","createValidator","z","string","uuid","enum","CTSMessagingMessageValidator","object","passthrough","or","null","undefined","optional","partyValidator","ctx","validator","array","output","Promise","all","map","el","run","path","pathAbsolute","group","isEventCallback","input","fnArgs","length","isEventTarget"],"mappings":";;;;;;AAAA;;;;;IAOO,IAAKA,sBAAAA,iBAAAA,SAAAA,sBAAAA,EAAAA;;;;;AAAAA,IAAAA,OAAAA,sBAAAA;AAMX,CAAA,CAAA,EAAA;AAEM,IAAA,sBAAKC,iBAAAA,SAAAA,sBAAAA,EAAAA;;;;;;;AAAAA,IAAAA,OAAAA,sBAAAA;AAQX,CAAA,CAAA,EAAA;;ACvBD;;;;;IAOO,IAAKC,qBAAAA,iBAAAA,SAAAA,qBAAAA,EAAAA;;AAAAA,IAAAA,OAAAA,qBAAAA;AAEX,CAAA,CAAA,EAAA;AAEM,IAAA,qBAAKC,iBAAAA,SAAAA,qBAAAA,EAAAA;;AAAAA,IAAAA,OAAAA,qBAAAA;AAEX,CAAA,CAAA,EAAA;;ACDM,MAAMC,0BAAmCC,SAAAA,iBAAAA,CAAAA;IAClCC,UAAa,GAAA;AACnB,QAAA,KAAK,CAACA,UAAAA,EAAAA;QAEN,IAAI,CAACC,KAAK,CACN,IAAA,EACAC,2BACIC,KAAEC,CAAAA,MAAM,GAAGC,IAAI,EAAA,CAAA,CAAA;AAIvB,QAAA,IAAI,CAACJ,KAAK,CACN,QACAC,0BACIC,CAAAA,KAAAA,CAAEG,IAAI,CAAC;AAAC,YAAA,MAAA;AAAQ,YAAA,OAAA;AAAS,YAAA;AAAS,SAAA,CAAA,CAAA,CAAA;AAG9C;AACJ;;AC9BA;;;;;AAKC,IAAA,SAAA,kBAAA,CAAA,GAAA,EAAA,OAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,EAAA,GAAA,EAAA,GAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQM,MAAMC,4BAAqCR,SAAAA,iBAAAA,CAAAA;IACpCC,UAAa,GAAA;AACnB,QAAA,KAAK,CAACA,UAAAA,EAAAA;QAEN,IAAI,CAACC,KAAK,CACN,MACAC,EAAAA,0BAAAA,CACIC,KAAEK,CAAAA,MAAM,CAAC,EACJC,CAAAA,CAAAA,WAAW,EACXC,CAAAA,EAAE,CAACP,KAAAA,CAAEC,MAAM,EAAA,CAAA,CACXM,EAAE,CAACP,KAAEQ,CAAAA,IAAI,EACTD,CAAAA,CAAAA,EAAE,CAACP,KAAAA,CAAES,SAAS,EAAA,CAAA,CACdC,QAAQ,EAAA,CAAA,CAAA;QAIrB,IAAI,CAACZ,KAAK,CACN,UAAA,EACAC,2BACIC,KAAEK,CAAAA,MAAM,CAAC,EAAIC,CAAAA,CAAAA,WAAW,GACnBC,EAAE,CAACP,MAAEQ,IAAI,EAAA,CAAA,CACTD,EAAE,CAACP,KAAAA,CAAES,SAAS,EAAA,CAAA,CACdC,QAAQ,EAAA,CAAA,CAAA;AAIrB,QAAA,MAAMC,iBAAiB,IAAIhB,0BAAAA,EAAAA;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/connection/constants.ts","../src/messaging/constants.ts","../src/messaging/validators/to.ts","../src/messaging/validators/message.ts","../src/utils.ts"],"sourcesContent":["/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum STCConnectionEventName {\n USER_CONNECTED = 'userConnected',\n USER_DISCONNECTED = 'userDisconnected',\n\n ROBOT_CONNECTED = 'robotConnected',\n ROBOT_DISCONNECTED = 'robotDisconnected',\n}\n\nexport enum CTSConnectionEventName {\n USER_CONNECTIONS = 'userConnections',\n USER_CONNECTION_SUBSCRIBE = 'userConnectionSubscribe',\n USER_CONNECTION_UNSUBSCRIBE = 'userConnectionUnsubscribe',\n\n ROBOT_CONNECTIONS = 'robotConnections',\n ROBOT_CONNECTION_SUBSCRIBE = 'robotConnectionSubscribe',\n ROBOT_CONNECTION_UNSUBSCRIBE = 'robotConnectionUnsubscribe',\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum STCMessagingEventName {\n SEND = 'send',\n}\n\nexport enum CTSMessagingEventName {\n SEND = 'send',\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { z } from 'zod';\nimport { createValidator } from '@validup/adapter-zod';\nimport { Container } from 'validup';\nimport type { CTSMessagingParty } from '../types';\n\nexport class CTSMessagingPartyValidator extends Container<CTSMessagingParty> {\n protected initialize() {\n super.initialize();\n\n this.mount(\n 'id',\n createValidator(\n z.string().uuid(),\n ),\n );\n\n this.mount(\n 'type',\n createValidator(\n z.enum(['user', 'robot', 'client']),\n ),\n );\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { z } from 'zod';\nimport { createValidator } from '@validup/adapter-zod';\nimport { Container } from 'validup';\nimport type { CTSMessagingMessage } from '../types';\nimport { CTSMessagingPartyValidator } from './to';\n\nexport class CTSMessagingMessageValidator extends Container<CTSMessagingMessage> {\n protected initialize() {\n super.initialize();\n\n this.mount(\n 'data',\n createValidator(\n z.object({})\n .passthrough()\n .or(z.string())\n .or(z.null())\n .or(z.undefined())\n .optional(),\n ),\n );\n\n this.mount(\n 'metadata',\n createValidator(\n z.object({}).passthrough()\n .or(z.null())\n .or(z.undefined())\n .optional(),\n ),\n );\n\n const partyValidator = new CTSMessagingPartyValidator();\n\n this.mount('to', async (ctx) => {\n const validator = createValidator(\n z.array(z.object({}).passthrough()),\n );\n\n const output = (await validator(ctx)) as unknown[];\n return Promise.all(output.map((el) => partyValidator.run(el, {\n path: ctx.pathAbsolute,\n group: ctx.group,\n })));\n });\n }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { EventCallback } from './types';\n\nexport function isEventCallback(\n input: unknown,\n fnArgs?: number,\n) : input is EventCallback {\n if (typeof fnArgs === 'undefined') {\n return typeof input === 'function';\n }\n\n return typeof input === 'function' &&\n input.length >= fnArgs;\n}\n\nexport function isEventTarget(\n input: unknown,\n) : input is EventTarget {\n return typeof input === 'number' ||\n typeof input === 'string' ||\n typeof input === 'undefined';\n}\n"],"names":["STCConnectionEventName","CTSConnectionEventName","STCMessagingEventName","CTSMessagingEventName","CTSMessagingPartyValidator","Container","initialize","mount","createValidator","z","string","uuid","enum","CTSMessagingMessageValidator","object","passthrough","or","null","undefined","optional","partyValidator","ctx","validator","array","output","Promise","all","map","el","run","path","pathAbsolute","group","isEventCallback","input","fnArgs","length","isEventTarget"],"mappings":";;;;;;AAAA;;;;;IAOO,IAAKA,sBAAAA,iBAAAA,SAAAA,sBAAAA,EAAAA;;;;;AAAAA,IAAAA,OAAAA,sBAAAA;AAMX,CAAA,CAAA,EAAA;AAEM,IAAA,sBAAKC,iBAAAA,SAAAA,sBAAAA,EAAAA;;;;;;;AAAAA,IAAAA,OAAAA,sBAAAA;AAQX,CAAA,CAAA,EAAA;;ACvBD;;;;;IAOO,IAAKC,qBAAAA,iBAAAA,SAAAA,qBAAAA,EAAAA;;AAAAA,IAAAA,OAAAA,qBAAAA;AAEX,CAAA,CAAA,EAAA;AAEM,IAAA,qBAAKC,iBAAAA,SAAAA,qBAAAA,EAAAA;;AAAAA,IAAAA,OAAAA,qBAAAA;AAEX,CAAA,CAAA,EAAA;;ACDM,MAAMC,0BAAmCC,SAAAA,iBAAAA,CAAAA;IAClCC,UAAa,GAAA;AACnB,QAAA,KAAK,CAACA,UAAAA,EAAAA;QAEN,IAAI,CAACC,KAAK,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dC,CAAAA,KAAAA,CAAEc,KAAK,CAACd,MAAEK,MAAM,CAAC,EAAC,CAAA,CAAGC,WAAW,EAAA,CAAA,CAAA;gBAGpC,MAAMS,MAAAA,GAAU,MAAMF,SAAUD,CAAAA,GAAAA,CAAAA;gBAChC,OAAOI,OAAAA,CAAQC,GAAG,CAACF,MAAOG,CAAAA,GAAG,CAAC,CAACC,EAAOR,GAAAA,cAAAA,CAAeS,GAAG,CAACD,EAAI,EAAA;AACzDE,wBAAAA,IAAAA,EAAMT,IAAIU,YAAY;AACtBC,wBAAAA,KAAAA,EAAOX,IAAIW;AACf,qBAAA,CAAA,CAAA,CAAA;AACJ,aAAA,CAAA,EAAA,CAAA;AACJ;AACJ;;ACrDA;;;;;AAKC,IAIM,SAASC,eACZC,CAAAA,KAAc,EACdC,MAAe,EAAA;IAEf,IAAI,OAAOA,WAAW,WAAa,EAAA;AAC/B,QAAA,OAAO,OAAOD,KAAU,KAAA,UAAA;AAC5B;AAEA,IAAA,OAAO,OAAOA,KAAAA,KAAU,UACpBA,IAAAA,KAAAA,CAAME,MAAM,IAAID,MAAAA;AACxB;AAEO,SAASE,cACZH,KAAc,EAAA;AAEd,IAAA,OAAO,OAAOA,KAAU,KAAA,QAAA,IACpB,OAAOA,KAAU,KAAA,QAAA,IACjB,OAAOA,KAAU,KAAA,WAAA;AACzB;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -90,19 +90,14 @@ class CTSMessagingMessageValidator extends Container {
|
|
|
90
90
|
this.mount('data', createValidator(z.object({}).passthrough().or(z.string()).or(z.null()).or(z.undefined()).optional()));
|
|
91
91
|
this.mount('metadata', createValidator(z.object({}).passthrough().or(z.null()).or(z.undefined()).optional()));
|
|
92
92
|
const partyValidator = new CTSMessagingPartyValidator();
|
|
93
|
-
this.mount('to',
|
|
94
|
-
var _ref = _async_to_generator(function*(ctx) {
|
|
93
|
+
this.mount('to', (ctx)=>/*#__PURE__*/ _async_to_generator(function*() {
|
|
95
94
|
const validator = createValidator(z.array(z.object({}).passthrough()));
|
|
96
95
|
const output = yield validator(ctx);
|
|
97
96
|
return Promise.all(output.map((el)=>partyValidator.run(el, {
|
|
98
97
|
path: ctx.pathAbsolute,
|
|
99
98
|
group: ctx.group
|
|
100
99
|
})));
|
|
101
|
-
});
|
|
102
|
-
return function(ctx) {
|
|
103
|
-
return _ref.apply(this, arguments);
|
|
104
|
-
};
|
|
105
|
-
}());
|
|
100
|
+
})());
|
|
106
101
|
}
|
|
107
102
|
}
|
|
108
103
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/connection/constants.ts","../src/messaging/constants.ts","../src/messaging/validators/to.ts","../src/messaging/validators/message.ts","../src/utils.ts"],"sourcesContent":["/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum STCConnectionEventName {\n USER_CONNECTED = 'userConnected',\n USER_DISCONNECTED = 'userDisconnected',\n\n ROBOT_CONNECTED = 'robotConnected',\n ROBOT_DISCONNECTED = 'robotDisconnected',\n}\n\nexport enum CTSConnectionEventName {\n USER_CONNECTIONS = 'userConnections',\n USER_CONNECTION_SUBSCRIBE = 'userConnectionSubscribe',\n USER_CONNECTION_UNSUBSCRIBE = 'userConnectionUnsubscribe',\n\n ROBOT_CONNECTIONS = 'robotConnections',\n ROBOT_CONNECTION_SUBSCRIBE = 'robotConnectionSubscribe',\n ROBOT_CONNECTION_UNSUBSCRIBE = 'robotConnectionUnsubscribe',\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum STCMessagingEventName {\n SEND = 'send',\n}\n\nexport enum CTSMessagingEventName {\n SEND = 'send',\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { z } from 'zod';\nimport { createValidator } from '@validup/adapter-zod';\nimport { Container } from 'validup';\nimport type { CTSMessagingParty } from '../types';\n\nexport class CTSMessagingPartyValidator extends Container<CTSMessagingParty> {\n protected initialize() {\n super.initialize();\n\n this.mount(\n 'id',\n createValidator(\n z.string().uuid(),\n ),\n );\n\n this.mount(\n 'type',\n createValidator(\n z.enum(['user', 'robot', 'client']),\n ),\n );\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { z } from 'zod';\nimport { createValidator } from '@validup/adapter-zod';\nimport { Container } from 'validup';\nimport type { CTSMessagingMessage } from '../types';\nimport { CTSMessagingPartyValidator } from './to';\n\nexport class CTSMessagingMessageValidator extends Container<CTSMessagingMessage> {\n protected initialize() {\n super.initialize();\n\n this.mount(\n 'data',\n createValidator(\n z.object({})\n .passthrough()\n .or(z.string())\n .or(z.null())\n .or(z.undefined())\n .optional(),\n ),\n );\n\n this.mount(\n 'metadata',\n createValidator(\n z.object({}).passthrough()\n .or(z.null())\n .or(z.undefined())\n .optional(),\n ),\n );\n\n const partyValidator = new CTSMessagingPartyValidator();\n\n this.mount('to', async (ctx) => {\n const validator = createValidator(\n z.array(z.object({}).passthrough()),\n );\n\n const output = (await validator(ctx)) as unknown[];\n return Promise.all(output.map((el) => partyValidator.run(el, {\n path: ctx.pathAbsolute,\n group: ctx.group,\n })));\n });\n }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { EventCallback } from './types';\n\nexport function isEventCallback(\n input: unknown,\n fnArgs?: number,\n) : input is EventCallback {\n if (typeof fnArgs === 'undefined') {\n return typeof input === 'function';\n }\n\n return typeof input === 'function' &&\n input.length >= fnArgs;\n}\n\nexport function isEventTarget(\n input: unknown,\n) : input is EventTarget {\n return typeof input === 'number' ||\n typeof input === 'string' ||\n typeof input === 'undefined';\n}\n"],"names":["STCConnectionEventName","CTSConnectionEventName","STCMessagingEventName","CTSMessagingEventName","CTSMessagingPartyValidator","Container","initialize","mount","createValidator","z","string","uuid","enum","CTSMessagingMessageValidator","object","passthrough","or","null","undefined","optional","partyValidator","ctx","validator","array","output","Promise","all","map","el","run","path","pathAbsolute","group","isEventCallback","input","fnArgs","length","isEventTarget"],"mappings":";;;;AAAA;;;;;IAOO,IAAKA,sBAAAA,iBAAAA,SAAAA,sBAAAA,EAAAA;;;;;AAAAA,IAAAA,OAAAA,sBAAAA;AAMX,CAAA,CAAA,EAAA;AAEM,IAAA,sBAAKC,iBAAAA,SAAAA,sBAAAA,EAAAA;;;;;;;AAAAA,IAAAA,OAAAA,sBAAAA;AAQX,CAAA,CAAA,EAAA;;ACvBD;;;;;IAOO,IAAKC,qBAAAA,iBAAAA,SAAAA,qBAAAA,EAAAA;;AAAAA,IAAAA,OAAAA,qBAAAA;AAEX,CAAA,CAAA,EAAA;AAEM,IAAA,qBAAKC,iBAAAA,SAAAA,qBAAAA,EAAAA;;AAAAA,IAAAA,OAAAA,qBAAAA;AAEX,CAAA,CAAA,EAAA;;ACDM,MAAMC,0BAAmCC,SAAAA,SAAAA,CAAAA;IAClCC,UAAa,GAAA;AACnB,QAAA,KAAK,CAACA,UAAAA,EAAAA;QAEN,IAAI,CAACC,KAAK,CACN,IAAA,EACAC,gBACIC,CAAEC,CAAAA,MAAM,GAAGC,IAAI,EAAA,CAAA,CAAA;AAIvB,QAAA,IAAI,CAACJ,KAAK,CACN,QACAC,eACIC,CAAAA,CAAAA,CAAEG,IAAI,CAAC;AAAC,YAAA,MAAA;AAAQ,YAAA,OAAA;AAAS,YAAA;AAAS,SAAA,CAAA,CAAA,CAAA;AAG9C;AACJ;;AC9BA;;;;;AAKC,IAAA,SAAA,kBAAA,CAAA,GAAA,EAAA,OAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,EAAA,GAAA,EAAA,GAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQM,MAAMC,4BAAqCR,SAAAA,SAAAA,CAAAA;IACpCC,UAAa,GAAA;AACnB,QAAA,KAAK,CAACA,UAAAA,EAAAA;QAEN,IAAI,CAACC,KAAK,CACN,MACAC,EAAAA,eAAAA,CACIC,CAAEK,CAAAA,MAAM,CAAC,EACJC,CAAAA,CAAAA,WAAW,EACXC,CAAAA,EAAE,CAACP,CAAAA,CAAEC,MAAM,EAAA,CAAA,CACXM,EAAE,CAACP,CAAEQ,CAAAA,IAAI,EACTD,CAAAA,CAAAA,EAAE,CAACP,CAAAA,CAAES,SAAS,EAAA,CAAA,CACdC,QAAQ,EAAA,CAAA,CAAA;QAIrB,IAAI,CAACZ,KAAK,CACN,UAAA,EACAC,gBACIC,CAAEK,CAAAA,MAAM,CAAC,EAAIC,CAAAA,CAAAA,WAAW,GACnBC,EAAE,CAACP,EAAEQ,IAAI,EAAA,CAAA,CACTD,EAAE,CAACP,CAAAA,CAAES,SAAS,EAAA,CAAA,CACdC,QAAQ,EAAA,CAAA,CAAA;AAIrB,QAAA,MAAMC,iBAAiB,IAAIhB,0BAAAA,EAAAA;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/connection/constants.ts","../src/messaging/constants.ts","../src/messaging/validators/to.ts","../src/messaging/validators/message.ts","../src/utils.ts"],"sourcesContent":["/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum STCConnectionEventName {\n USER_CONNECTED = 'userConnected',\n USER_DISCONNECTED = 'userDisconnected',\n\n ROBOT_CONNECTED = 'robotConnected',\n ROBOT_DISCONNECTED = 'robotDisconnected',\n}\n\nexport enum CTSConnectionEventName {\n USER_CONNECTIONS = 'userConnections',\n USER_CONNECTION_SUBSCRIBE = 'userConnectionSubscribe',\n USER_CONNECTION_UNSUBSCRIBE = 'userConnectionUnsubscribe',\n\n ROBOT_CONNECTIONS = 'robotConnections',\n ROBOT_CONNECTION_SUBSCRIBE = 'robotConnectionSubscribe',\n ROBOT_CONNECTION_UNSUBSCRIBE = 'robotConnectionUnsubscribe',\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum STCMessagingEventName {\n SEND = 'send',\n}\n\nexport enum CTSMessagingEventName {\n SEND = 'send',\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { z } from 'zod';\nimport { createValidator } from '@validup/adapter-zod';\nimport { Container } from 'validup';\nimport type { CTSMessagingParty } from '../types';\n\nexport class CTSMessagingPartyValidator extends Container<CTSMessagingParty> {\n protected initialize() {\n super.initialize();\n\n this.mount(\n 'id',\n createValidator(\n z.string().uuid(),\n ),\n );\n\n this.mount(\n 'type',\n createValidator(\n z.enum(['user', 'robot', 'client']),\n ),\n );\n }\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { z } from 'zod';\nimport { createValidator } from '@validup/adapter-zod';\nimport { Container } from 'validup';\nimport type { CTSMessagingMessage } from '../types';\nimport { CTSMessagingPartyValidator } from './to';\n\nexport class CTSMessagingMessageValidator extends Container<CTSMessagingMessage> {\n protected initialize() {\n super.initialize();\n\n this.mount(\n 'data',\n createValidator(\n z.object({})\n .passthrough()\n .or(z.string())\n .or(z.null())\n .or(z.undefined())\n .optional(),\n ),\n );\n\n this.mount(\n 'metadata',\n createValidator(\n z.object({}).passthrough()\n .or(z.null())\n .or(z.undefined())\n .optional(),\n ),\n );\n\n const partyValidator = new CTSMessagingPartyValidator();\n\n this.mount('to', async (ctx) => {\n const validator = createValidator(\n z.array(z.object({}).passthrough()),\n );\n\n const output = (await validator(ctx)) as unknown[];\n return Promise.all(output.map((el) => partyValidator.run(el, {\n path: ctx.pathAbsolute,\n group: ctx.group,\n })));\n });\n }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { EventCallback } from './types';\n\nexport function isEventCallback(\n input: unknown,\n fnArgs?: number,\n) : input is EventCallback {\n if (typeof fnArgs === 'undefined') {\n return typeof input === 'function';\n }\n\n return typeof input === 'function' &&\n input.length >= fnArgs;\n}\n\nexport function isEventTarget(\n input: unknown,\n) : input is EventTarget {\n return typeof input === 'number' ||\n typeof input === 'string' ||\n typeof input === 'undefined';\n}\n"],"names":["STCConnectionEventName","CTSConnectionEventName","STCMessagingEventName","CTSMessagingEventName","CTSMessagingPartyValidator","Container","initialize","mount","createValidator","z","string","uuid","enum","CTSMessagingMessageValidator","object","passthrough","or","null","undefined","optional","partyValidator","ctx","validator","array","output","Promise","all","map","el","run","path","pathAbsolute","group","isEventCallback","input","fnArgs","length","isEventTarget"],"mappings":";;;;AAAA;;;;;IAOO,IAAKA,sBAAAA,iBAAAA,SAAAA,sBAAAA,EAAAA;;;;;AAAAA,IAAAA,OAAAA,sBAAAA;AAMX,CAAA,CAAA,EAAA;AAEM,IAAA,sBAAKC,iBAAAA,SAAAA,sBAAAA,EAAAA;;;;;;;AAAAA,IAAAA,OAAAA,sBAAAA;AAQX,CAAA,CAAA,EAAA;;ACvBD;;;;;IAOO,IAAKC,qBAAAA,iBAAAA,SAAAA,qBAAAA,EAAAA;;AAAAA,IAAAA,OAAAA,qBAAAA;AAEX,CAAA,CAAA,EAAA;AAEM,IAAA,qBAAKC,iBAAAA,SAAAA,qBAAAA,EAAAA;;AAAAA,IAAAA,OAAAA,qBAAAA;AAEX,CAAA,CAAA,EAAA;;ACDM,MAAMC,0BAAmCC,SAAAA,SAAAA,CAAAA;IAClCC,UAAa,GAAA;AACnB,QAAA,KAAK,CAACA,UAAAA,EAAAA;QAEN,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AA,GAAYd,eACdC,CAAAA,CAAAA,CAAEc,KAAK,CAACd,EAAEK,MAAM,CAAC,EAAC,CAAA,CAAGC,WAAW,EAAA,CAAA,CAAA;gBAGpC,MAAMS,MAAAA,GAAU,MAAMF,SAAUD,CAAAA,GAAAA,CAAAA;gBAChC,OAAOI,OAAAA,CAAQC,GAAG,CAACF,MAAOG,CAAAA,GAAG,CAAC,CAACC,EAAOR,GAAAA,cAAAA,CAAeS,GAAG,CAACD,EAAI,EAAA;AACzDE,wBAAAA,IAAAA,EAAMT,IAAIU,YAAY;AACtBC,wBAAAA,KAAAA,EAAOX,IAAIW;AACf,qBAAA,CAAA,CAAA,CAAA;AACJ,aAAA,CAAA,EAAA,CAAA;AACJ;AACJ;;ACrDA;;;;;AAKC,IAIM,SAASC,eACZC,CAAAA,KAAc,EACdC,MAAe,EAAA;IAEf,IAAI,OAAOA,WAAW,WAAa,EAAA;AAC/B,QAAA,OAAO,OAAOD,KAAU,KAAA,UAAA;AAC5B;AAEA,IAAA,OAAO,OAAOA,KAAAA,KAAU,UACpBA,IAAAA,KAAAA,CAAME,MAAM,IAAID,MAAAA;AACxB;AAEO,SAASE,cACZH,KAAc,EAAA;AAEd,IAAA,OAAO,OAAOA,KAAU,KAAA,QAAA,IACpB,OAAOA,KAAU,KAAA,QAAA,IACjB,OAAOA,KAAU,KAAA,WAAA;AACzB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privateaim/messenger-kit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"exports": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"zod": "^3.24.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@privateaim/core-kit": "^0.8.
|
|
36
|
+
"@privateaim/core-kit": "^0.8.12"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@privateaim/core-kit": "^0.8.
|
|
39
|
+
"@privateaim/core-kit": "^0.8.12"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|