kozz-module-maker 0.1.21 → 0.2.1
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/.babelrc +24 -0
- package/bun.lock +617 -0
- package/dist/InlineCommands/index.js +19 -11
- package/dist/Instance/Basic/index.d.ts +40 -0
- package/dist/Instance/Basic/index.js +43 -0
- package/dist/Instance/Basic/index.js.map +1 -0
- package/dist/Instance/BasicController/index.d.ts +40 -0
- package/dist/Instance/BasicController/index.js +43 -0
- package/dist/Instance/BasicController/index.js.map +1 -0
- package/dist/Instance/CommandHandler/index.d.ts +20 -0
- package/dist/Instance/CommandHandler/index.js +26 -0
- package/dist/Instance/CommandHandler/index.js.map +1 -0
- package/dist/Instance/Common/ResourceMap/index.js +17 -15
- package/dist/Instance/Common/UseFns/index.js +24 -19
- package/dist/Instance/Common/index.js +31 -9
- package/dist/Instance/Common/onEvent/index.js +82 -76
- package/dist/Instance/Common/onEvent/index.js.map +1 -1
- package/dist/Instance/GeneralHandler/index.d.ts +19 -0
- package/dist/Instance/GeneralHandler/index.js +49 -0
- package/dist/Instance/GeneralHandler/index.js.map +1 -0
- package/dist/Instance/GeneralModule/index.d.ts +1 -2
- package/dist/Instance/GeneralModule/index.js +83 -58
- package/dist/Instance/GeneralModule/index.js.map +1 -1
- package/dist/Instance/Handler/index.d.ts +23 -0
- package/dist/Instance/Handler/index.js +26 -0
- package/dist/Instance/Handler/index.js.map +1 -0
- package/dist/Instance/Proxy/index.d.ts +22 -0
- package/dist/Instance/Proxy/index.js +36 -0
- package/dist/Instance/Proxy/index.js.map +1 -0
- package/dist/Instance/index.d.ts +14 -0
- package/dist/Instance/index.js +20 -0
- package/dist/Instance/index.js.map +1 -0
- package/dist/Message/FromTemplate/index.js +53 -46
- package/dist/Message/PayloadCreation/Media.js +40 -36
- package/dist/Message/PayloadCreation/Media.js.map +1 -1
- package/dist/Message/PayloadCreation/React.js +11 -9
- package/dist/Message/PayloadCreation/Reply.js +37 -35
- package/dist/Message/PayloadCreation/Reply.js.map +1 -1
- package/dist/Message/PayloadCreation/ReplyWithSticker.d.ts +0 -0
- package/dist/Message/PayloadCreation/ReplyWithSticker.js +1 -0
- package/dist/Message/PayloadCreation/ReplyWithText.d.ts +2 -0
- package/dist/Message/PayloadCreation/ReplyWithText.js +15 -0
- package/dist/Message/PayloadCreation/deleteMessage.js +10 -8
- package/dist/Message/PayloadCreation/index.js +25 -17
- package/dist/Message/PayloadCreation/sendMessage.js +23 -21
- package/dist/Message/PayloadCreation/sendMessage.js.map +1 -1
- package/dist/Message/ProxiedMessage/index.d.ts +1 -1
- package/dist/Message/ProxiedMessage/index.js +17 -11
- package/dist/Message/RoutineCreation/AskResource/AskResourceApi/index.js +21 -16
- package/dist/Message/RoutineCreation/AskResource/index.js +58 -56
- package/dist/Message/RoutineCreation/DeleteMessage/index.js +18 -14
- package/dist/Message/RoutineCreation/Reply/WithMedia.js +32 -30
- package/dist/Message/RoutineCreation/Reply/WithSticke.d.ts +3 -0
- package/dist/Message/RoutineCreation/Reply/WithSticke.js +9 -0
- package/dist/Message/RoutineCreation/Reply/WithSticke.js.map +1 -0
- package/dist/Message/RoutineCreation/Reply/WithSticker.js +14 -8
- package/dist/Message/RoutineCreation/Reply/WithTemplate.js +15 -15
- package/dist/Message/RoutineCreation/Reply/index.js +25 -9
- package/dist/Message/RoutineCreation/SendMessage/index.js +25 -23
- package/dist/Message/RoutineCreation/SendMessage/index.js.map +1 -1
- package/dist/Message/RoutineCreation/reply.js +16 -14
- package/dist/Message/index.d.ts +1 -1
- package/dist/Message/index.js +49 -46
- package/dist/Message/kozz-md.parser/index.js +42 -92
- package/dist/Message/zap-md.parser/index.d.ts +1 -0
- package/dist/Message/zap-md.parser/index.js +2 -0
- package/dist/MessageTemplate/h.d.ts +3 -0
- package/dist/MessageTemplate/h.js +24 -0
- package/dist/MessageTemplate/h.js.map +1 -0
- package/dist/MessageTemplate/htm.d.ts +1 -0
- package/dist/MessageTemplate/htm.js +10 -0
- package/dist/MessageTemplate/htm.js.map +1 -0
- package/dist/MessageTemplate/renderer.d.ts +13 -0
- package/dist/MessageTemplate/renderer.js +62 -0
- package/dist/MessageTemplate/renderer.js.map +1 -0
- package/dist/MessageTemplate/types.d.ts +12 -0
- package/dist/MessageTemplate/types.js +5 -0
- package/dist/MessageTemplate/types.js.map +1 -0
- package/dist/Schema/index.js +11 -9
- package/dist/Socket/Events/Command.d.ts +3 -0
- package/dist/Socket/Events/Command.js +19 -0
- package/dist/Socket/Events/Command.js.map +1 -0
- package/dist/Socket/Events/Emit/ForwardEvent.js +19 -17
- package/dist/Socket/Events/Emit/Introduction.js +12 -10
- package/dist/Socket/Events/Emit/ProxyRequest.d.ts +0 -0
- package/dist/Socket/Events/Emit/ProxyRequest.js +2 -0
- package/dist/Socket/Events/Emit/ProxyRequest.js.map +1 -0
- package/dist/Socket/Events/Emit/RequestProxy.js +13 -10
- package/dist/Socket/Events/Emit/RevokeProxy.js +9 -7
- package/dist/Socket/Events/Handle/AskResource.js +27 -25
- package/dist/Socket/Events/Handle/Command.js +35 -38
- package/dist/Socket/Events/Handle/ProxiedMessage.js +11 -9
- package/dist/Socket/Events/Introduction.d.ts +3 -0
- package/dist/Socket/Events/Introduction.js +15 -0
- package/dist/Socket/Events/Introduction.js.map +1 -0
- package/dist/Socket/Events/ProxiedMessage.d.ts +2 -0
- package/dist/Socket/Events/ProxiedMessage.js +10 -0
- package/dist/Socket/Events/ProxiedMessage.js.map +1 -0
- package/dist/Socket/Messages/Command.d.ts +2 -0
- package/dist/Socket/Messages/Command.js +6 -0
- package/dist/Socket/Messages/Command.js.map +1 -0
- package/dist/Socket/Messages/Introduction.d.ts +3 -0
- package/dist/Socket/Messages/Introduction.js +15 -0
- package/dist/Socket/Messages/Introduction.js.map +1 -0
- package/dist/Socket/index.js +17 -15
- package/dist/StateMachine/index.js +44 -38
- package/dist/Validator/index.js +41 -38
- package/dist/debugIndex.d.ts +1 -0
- package/dist/debugIndex.js +73 -0
- package/dist/debugIndex.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +47 -18
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime/MessageTemplating.js +51 -0
- package/dist/jsx-runtime/index.js +83 -0
- package/dist/messages.kozz.md +52 -0
- package/dist/util/index.js +63 -59
- package/dist/util/index.js.map +1 -1
- package/dist/util.d.ts +8 -0
- package/dist/util.js +36 -0
- package/dist/util.js.map +1 -0
- package/package.json +21 -17
- package/tsconfig.json +26 -97
- package/jest.config.ts +0 -196
- package/test.kozz.md +0 -81
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.replyWithText = exports.replyWithSticker = exports.replyWithMediaFromUrl = exports.replyWithMedia = void 0;
|
|
4
7
|
const replyWithText = (messagePayload, string) => ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
body: string,
|
|
9
|
+
boundaryId: messagePayload.boundaryId,
|
|
10
|
+
chatId: messagePayload.to,
|
|
11
|
+
contact: messagePayload.contact,
|
|
12
|
+
platform: messagePayload.platform,
|
|
13
|
+
timestamp: new Date().getTime(),
|
|
14
|
+
quoteId: messagePayload.id
|
|
12
15
|
});
|
|
13
16
|
exports.replyWithText = replyWithText;
|
|
14
17
|
const replyWithSticker = (messagePayload, media) => ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
body: '',
|
|
19
|
+
media: media,
|
|
20
|
+
chatId: messagePayload.to,
|
|
21
|
+
platform: 'other',
|
|
22
|
+
timestamp: new Date().getTime(),
|
|
23
|
+
quoteId: messagePayload.id,
|
|
24
|
+
boundaryId: messagePayload.boundaryId,
|
|
25
|
+
contact: messagePayload.contact
|
|
23
26
|
});
|
|
24
27
|
exports.replyWithSticker = replyWithSticker;
|
|
25
28
|
const replyWithMedia = (messagePayload, media, caption) => ({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
body: caption || '',
|
|
30
|
+
media: media,
|
|
31
|
+
chatId: messagePayload.to,
|
|
32
|
+
platform: 'other',
|
|
33
|
+
timestamp: new Date().getTime(),
|
|
34
|
+
quoteId: messagePayload.id,
|
|
35
|
+
boundaryId: messagePayload.boundaryId,
|
|
36
|
+
contact: messagePayload.contact
|
|
34
37
|
});
|
|
35
38
|
exports.replyWithMedia = replyWithMedia;
|
|
36
39
|
const replyWithMediaFromUrl = (messagePayload, media, caption) => ({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
body: caption || '',
|
|
41
|
+
media: media,
|
|
42
|
+
chatId: messagePayload.to,
|
|
43
|
+
platform: 'other',
|
|
44
|
+
timestamp: new Date().getTime(),
|
|
45
|
+
quoteId: messagePayload.id,
|
|
46
|
+
boundaryId: messagePayload.boundaryId,
|
|
47
|
+
contact: messagePayload.contact
|
|
45
48
|
});
|
|
46
|
-
exports.replyWithMediaFromUrl = replyWithMediaFromUrl;
|
|
47
|
-
//# sourceMappingURL=Reply.js.map
|
|
49
|
+
exports.replyWithMediaFromUrl = replyWithMediaFromUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reply.js","sourceRoot":"","sources":["../../../src/Message/PayloadCreation/Reply.ts"],"names":[],"mappings":";;;AAMO,MAAM,aAAa,GAAG,CAC5B,cAAwC,EACxC,MAAc,EACO,EAAE,CAAC,CAAC;IACzB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,cAAc,CAAC,UAAU;IACrC,MAAM,EAAE,cAAc,CAAC,EAAE;IACzB,OAAO,EAAE,cAAc,CAAC,OAAO;IAC/B,QAAQ,EAAE,cAAc,CAAC,QAAQ;IACjC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;IAC/B,OAAO,EAAE,cAAc,CAAC,EAAE;CAC1B,CAAC,CAAC;AAXU,QAAA,aAAa,iBAWvB;AAEI,MAAM,gBAAgB,GAAG,CAC/B,cAAwC,EACxC,KAAY,EACS,EAAE,CAAC,CAAC;IACzB,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,cAAc,CAAC,EAAE;IACzB,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"Reply.js","sourceRoot":"","sources":["../../../src/Message/PayloadCreation/Reply.ts"],"names":[],"mappings":";;;AAMO,MAAM,aAAa,GAAG,CAC5B,cAAwC,EACxC,MAAc,EACO,EAAE,CAAC,CAAC;IACzB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,cAAc,CAAC,UAAU;IACrC,MAAM,EAAE,cAAc,CAAC,EAAE;IACzB,OAAO,EAAE,cAAc,CAAC,OAAO;IAC/B,QAAQ,EAAE,cAAc,CAAC,QAAQ;IACjC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;IAC/B,OAAO,EAAE,cAAc,CAAC,EAAE;CAC1B,CAAC,CAAC;AAXU,QAAA,aAAa,iBAWvB;AAEI,MAAM,gBAAgB,GAAG,CAC/B,cAAwC,EACxC,KAAY,EACS,EAAE,CAAC,CAAC;IACzB,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,cAAc,CAAC,EAAE;IACzB,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;IAC/B,OAAO,EAAE,cAAc,CAAC,EAAE;IAC1B,UAAU,EAAE,cAAc,CAAC,UAAU;IACrC,OAAO,EAAE,cAAc,CAAC,OAAO;CAC/B,CAAC,CAAC;AAZU,QAAA,gBAAgB,oBAY1B;AAEI,MAAM,cAAc,GAAG,CAC7B,cAAwC,EACxC,KAAY,EACZ,OAAgB,EACK,EAAE,CAAC,CAAC;IACzB,IAAI,EAAE,OAAO,IAAI,EAAE;IACnB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,cAAc,CAAC,EAAE;IACzB,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;IAC/B,OAAO,EAAE,cAAc,CAAC,EAAE;IAC1B,UAAU,EAAE,cAAc,CAAC,UAAU;IACrC,OAAO,EAAE,cAAc,CAAC,OAAO;CAC/B,CAAC,CAAC;AAbU,QAAA,cAAc,kBAaxB;AAEI,MAAM,qBAAqB,GAAG,CACpC,cAAwC,EACxC,KAAY,EACZ,OAAgB,EACK,EAAE,CAAC,CAAC;IACzB,IAAI,EAAE,OAAO,IAAI,EAAE;IACnB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,cAAc,CAAC,EAAE;IACzB,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;IAC/B,OAAO,EAAE,cAAc,CAAC,EAAE;IAC1B,UAAU,EAAE,cAAc,CAAC,UAAU;IACrC,OAAO,EAAE,cAAc,CAAC,OAAO;CAC/B,CAAC,CAAC;AAbU,QAAA,qBAAqB,yBAa/B"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replyWithText = void 0;
|
|
4
|
+
const replyWithText = (command, string) => ({
|
|
5
|
+
body: string,
|
|
6
|
+
boundaryId: command.boundaryId,
|
|
7
|
+
chatId: command.message.fromHostAccount
|
|
8
|
+
? command.message.to
|
|
9
|
+
: command.message.from,
|
|
10
|
+
contact: command.message.contact,
|
|
11
|
+
platform: command.message.platform,
|
|
12
|
+
timestamp: new Date().getTime(),
|
|
13
|
+
quoteId: command.message.id,
|
|
14
|
+
});
|
|
15
|
+
exports.replyWithText = replyWithText;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.createDeleteMessagePayload = void 0;
|
|
4
7
|
const createDeleteMessagePayload = (boundaryName, messageId, local = false) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
return {
|
|
9
|
+
boundaryName,
|
|
10
|
+
messageId,
|
|
11
|
+
localDelete: !!local
|
|
12
|
+
};
|
|
10
13
|
};
|
|
11
|
-
exports.createDeleteMessagePayload = createDeleteMessagePayload;
|
|
12
|
-
//# sourceMappingURL=deleteMessage.js.map
|
|
14
|
+
exports.createDeleteMessagePayload = createDeleteMessagePayload;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Reply = require("./Reply");
|
|
7
|
+
Object.keys(_Reply).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Reply[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Reply[key];
|
|
7
14
|
}
|
|
8
|
-
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _deleteMessage = require("./deleteMessage");
|
|
18
|
+
Object.keys(_deleteMessage).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _deleteMessage[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _deleteMessage[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.createSendMessagePayload = void 0;
|
|
4
7
|
const createSendMessagePayload = (handlerName, contactId, boundaryId, body, media) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
return {
|
|
9
|
+
body,
|
|
10
|
+
boundaryId: boundaryId,
|
|
11
|
+
chatId: contactId,
|
|
12
|
+
contact: {
|
|
13
|
+
publicName: handlerName,
|
|
14
|
+
privateName: handlerName,
|
|
15
|
+
id: handlerName,
|
|
16
|
+
isBlocked: false,
|
|
17
|
+
hostAdded: true,
|
|
18
|
+
isGroup: false,
|
|
19
|
+
isHostAccount: true
|
|
20
|
+
},
|
|
21
|
+
platform: 'other',
|
|
22
|
+
timestamp: new Date().getTime(),
|
|
23
|
+
quoteId: undefined,
|
|
24
|
+
media
|
|
25
|
+
};
|
|
23
26
|
};
|
|
24
|
-
exports.createSendMessagePayload = createSendMessagePayload;
|
|
25
|
-
//# sourceMappingURL=sendMessage.js.map
|
|
27
|
+
exports.createSendMessagePayload = createSendMessagePayload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendMessage.js","sourceRoot":"","sources":["../../../src/Message/PayloadCreation/sendMessage.ts"],"names":[],"mappings":";;;AAEO,MAAM,wBAAwB,GAAG,CACvC,WAAmB,EACnB,SAAiB,EACjB,UAAkB,EAClB,IAAY,EACZ,KAAa,EACQ,EAAE;IACvB,OAAO;QACN,IAAI;QACJ,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE;YACR,UAAU,EAAE,WAAW;YACvB,WAAW,EAAE,WAAW;YACxB,EAAE,EAAE,WAAW;YACf,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,IAAI;SACnB;QACD,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"sendMessage.js","sourceRoot":"","sources":["../../../src/Message/PayloadCreation/sendMessage.ts"],"names":[],"mappings":";;;AAEO,MAAM,wBAAwB,GAAG,CACvC,WAAmB,EACnB,SAAiB,EACjB,UAAkB,EAClB,IAAY,EACZ,KAAa,EACQ,EAAE;IACvB,OAAO;QACN,IAAI;QACJ,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE;YACR,UAAU,EAAE,WAAW;YACvB,WAAW,EAAE,WAAW;YACxB,EAAE,EAAE,WAAW;YACf,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,IAAI;SACnB;QACD,QAAQ,EAAE,OAAO;QACjB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;QAC/B,OAAO,EAAE,SAAS;QAClB,KAAK;KACL,CAAC;AACH,CAAC,CAAC;AAzBW,QAAA,wBAAwB,4BAyBnC"}
|
|
@@ -13,7 +13,7 @@ export declare const createProxiedMessageOject: (socket: Socket, source: Source,
|
|
|
13
13
|
}, "id">;
|
|
14
14
|
responder: {
|
|
15
15
|
id: string;
|
|
16
|
-
type: import("kozz-types").
|
|
16
|
+
type: import("kozz-types").EntityType;
|
|
17
17
|
};
|
|
18
18
|
}): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
19
19
|
boundary(boundaryId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.createProxiedMessageOject = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
var _ = require("..");
|
|
8
|
+
var _RevokeProxy = require("../../Socket/Events/Emit/RevokeProxy");
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
13
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
14
|
const createProxiedMessageOject = (socket, source, message, handlerName) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
15
|
+
const messageObject = (0, _.createMessageObject)(socket, message, handlerName);
|
|
16
|
+
const revoke = () => (0, _RevokeProxy.revokeProxy)(socket, source);
|
|
17
|
+
return _objectSpread(_objectSpread({}, messageObject), {}, {
|
|
18
|
+
revoke
|
|
19
|
+
});
|
|
13
20
|
};
|
|
14
|
-
exports.createProxiedMessageOject = createProxiedMessageOject;
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
exports.createProxiedMessageOject = createProxiedMessageOject;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.ask = void 0;
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
12
|
/**
|
|
5
13
|
* Promisified interface for askin resource to other entities connected to the
|
|
6
14
|
* gateway
|
|
@@ -9,20 +17,17 @@ exports.ask = void 0;
|
|
|
9
17
|
* @returns {Promise<ProvideResourcePayload>}
|
|
10
18
|
*/
|
|
11
19
|
const ask = async (socket, requestData) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
socket.
|
|
21
|
-
|
|
22
|
-
socket.once(`reply_resource/${requestId}`, (payload) => {
|
|
23
|
-
resolve(payload);
|
|
24
|
-
});
|
|
20
|
+
const requestId = `${requestData.responder.id}/${requestData.timestamp * 100 + Math.random() * 100}`;
|
|
21
|
+
const requestPayload = _objectSpread(_objectSpread({}, requestData), {}, {
|
|
22
|
+
request: _objectSpread(_objectSpread({}, requestData.request), {}, {
|
|
23
|
+
id: requestId
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
socket.emit('ask_resource', requestPayload);
|
|
27
|
+
return new Promise(resolve => {
|
|
28
|
+
socket.once(`reply_resource/${requestId}`, payload => {
|
|
29
|
+
resolve(payload);
|
|
25
30
|
});
|
|
31
|
+
});
|
|
26
32
|
};
|
|
27
|
-
exports.ask = ask;
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
33
|
+
exports.ask = ask;
|
|
@@ -1,60 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.createAskResource = void 0;
|
|
4
|
-
|
|
7
|
+
var _AskResourceApi = require("./AskResourceApi");
|
|
5
8
|
const createAskResource = (socket, args) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
9
|
+
const ask = async askArgs => {
|
|
10
|
+
const response = await (0, _AskResourceApi.ask)(socket, {
|
|
11
|
+
request: askArgs.resource,
|
|
12
|
+
responder: askArgs.responder,
|
|
13
|
+
requester: args.requester,
|
|
14
|
+
timestamp: new Date().getTime()
|
|
15
|
+
});
|
|
16
|
+
return response;
|
|
17
|
+
};
|
|
18
|
+
ask.boundary = (boundaryId, resourceName, requestArgs = {}) => {
|
|
19
|
+
return (0, _AskResourceApi.ask)(socket, {
|
|
20
|
+
request: {
|
|
21
|
+
resource: resourceName,
|
|
22
|
+
data: requestArgs
|
|
23
|
+
},
|
|
24
|
+
requester: args.requester,
|
|
25
|
+
timestamp: new Date().getTime(),
|
|
26
|
+
responder: {
|
|
27
|
+
id: boundaryId,
|
|
28
|
+
type: 'Boundary'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
ask.handler = (handlerId, resourceName, requestArgs = {}) => {
|
|
33
|
+
return (0, _AskResourceApi.ask)(socket, {
|
|
34
|
+
request: {
|
|
35
|
+
resource: resourceName,
|
|
36
|
+
data: requestArgs
|
|
37
|
+
},
|
|
38
|
+
requester: args.requester,
|
|
39
|
+
timestamp: new Date().getTime(),
|
|
40
|
+
responder: {
|
|
41
|
+
id: handlerId,
|
|
42
|
+
type: 'Handler'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
ask.gateway = (resourceName, requestArgs = {}) => {
|
|
47
|
+
return (0, _AskResourceApi.ask)(socket, {
|
|
48
|
+
request: {
|
|
49
|
+
resource: resourceName,
|
|
50
|
+
data: requestArgs
|
|
51
|
+
},
|
|
52
|
+
requester: args.requester,
|
|
53
|
+
timestamp: new Date().getTime(),
|
|
54
|
+
responder: {
|
|
55
|
+
id: 'Gateway',
|
|
56
|
+
type: 'Gateway'
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return ask;
|
|
58
61
|
};
|
|
59
|
-
exports.createAskResource = createAskResource;
|
|
60
|
-
//# sourceMappingURL=index.js.map
|
|
62
|
+
exports.createAskResource = createAskResource;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSelfDelete = exports.addSelfDeleteToMessages = void 0;
|
|
7
|
+
var _PayloadCreation = require("../../../Message/PayloadCreation");
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
13
|
const createSelfDelete = (socket, messagePayload) => (localDelete = false) => {
|
|
6
|
-
|
|
7
|
-
|
|
14
|
+
const deletePayload = (0, _PayloadCreation.createDeleteMessagePayload)(messagePayload.boundaryName, messagePayload.id, localDelete);
|
|
15
|
+
return socket.emit('delete_message', deletePayload);
|
|
8
16
|
};
|
|
9
17
|
exports.createSelfDelete = createSelfDelete;
|
|
10
18
|
const addSelfDeleteToMessages = (socket, message) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
? (0, exports.addSelfDeleteToMessages)(socket, message.quotedMessage)
|
|
16
|
-
: undefined,
|
|
17
|
-
};
|
|
19
|
+
return _objectSpread(_objectSpread({}, message), {}, {
|
|
20
|
+
delete: createSelfDelete(socket, message),
|
|
21
|
+
quotedMessage: message.quotedMessage ? addSelfDeleteToMessages(socket, message.quotedMessage) : undefined
|
|
22
|
+
});
|
|
18
23
|
};
|
|
19
|
-
exports.addSelfDeleteToMessages = addSelfDeleteToMessages;
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
24
|
+
exports.addSelfDeleteToMessages = addSelfDeleteToMessages;
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.withMedia = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
var _PayloadCreation = require("../../PayloadCreation");
|
|
8
|
+
var _Media = require("../../PayloadCreation/Media");
|
|
6
9
|
const withMedia = (socket, messagePayload) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Replies with a media
|
|
12
|
+
* @param {Media} media
|
|
13
|
+
* @param {string} caption
|
|
14
|
+
*/
|
|
15
|
+
const replyMedia = (media, caption) => {
|
|
16
|
+
socket.emit('reply_with_media', (0, _PayloadCreation.replyWithMedia)(messagePayload, media, caption));
|
|
17
|
+
};
|
|
18
|
+
replyMedia.fromPath = async (path, mimeType, caption) => {
|
|
19
|
+
const media = await (0, _Media.loadMediaFromPath)(path, mimeType);
|
|
20
|
+
replyMedia(media, caption);
|
|
21
|
+
};
|
|
22
|
+
replyMedia.fromBuffer = (buffer, mimeType, caption, fileName) => {
|
|
23
|
+
const media = (0, _Media.createMediaFromBuffer)(buffer, mimeType, fileName);
|
|
24
|
+
replyMedia(media, caption);
|
|
25
|
+
};
|
|
26
|
+
replyMedia.fromB64 = (b64, mimeType, caption, fileName) => {
|
|
27
|
+
const media = (0, _Media.createMediaFromB64)(b64, mimeType, fileName);
|
|
28
|
+
replyMedia(media, caption);
|
|
29
|
+
};
|
|
30
|
+
replyMedia.fromUrl = (url, mimeType, caption) => {
|
|
31
|
+
const media = (0, _Media.createMediaFromUrl)(url, mimeType);
|
|
32
|
+
replyMedia(media, caption);
|
|
33
|
+
};
|
|
34
|
+
return replyMedia;
|
|
32
35
|
};
|
|
33
|
-
exports.withMedia = withMedia;
|
|
34
|
-
//# sourceMappingURL=WithMedia.js.map
|
|
36
|
+
exports.withMedia = withMedia;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withSticker = void 0;
|
|
4
|
+
const PayloadCreation_1 = require("../../../Message/PayloadCreation");
|
|
5
|
+
const withSticker = (socket, command) => (media) => {
|
|
6
|
+
socket.emit('reply_with_sticker', (0, PayloadCreation_1.replyWithSticker)(command, media));
|
|
7
|
+
};
|
|
8
|
+
exports.withSticker = withSticker;
|
|
9
|
+
//# sourceMappingURL=WithSticke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithSticke.js","sourceRoot":"","sources":["../../../../src/Message/RoutineCreation/Reply/WithSticke.ts"],"names":[],"mappings":";;;AAEA,sEAAoE;AAE7D,MAAM,WAAW,GACvB,CAAC,MAAc,EAAE,OAAgB,EAAE,EAAE,CAAC,CAAC,KAAY,EAAE,EAAE;IACtD,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAA,kCAAgB,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC;AAHU,QAAA,WAAW,eAGrB"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.withSticker = void 0;
|
|
4
|
-
|
|
7
|
+
var _PayloadCreation = require("../../PayloadCreation");
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
13
|
const withSticker = (socket, messagePayload) => (media, tags = []) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}));
|
|
14
|
+
socket.emit('reply_with_sticker', (0, _PayloadCreation.replyWithSticker)(messagePayload, _objectSpread(_objectSpread({}, media), {}, {
|
|
15
|
+
stickerTags: tags
|
|
16
|
+
})));
|
|
10
17
|
};
|
|
11
|
-
exports.withSticker = withSticker;
|
|
12
|
-
//# sourceMappingURL=WithSticker.js.map
|
|
18
|
+
exports.withSticker = withSticker;
|