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.
Files changed (125) hide show
  1. package/.babelrc +24 -0
  2. package/bun.lock +617 -0
  3. package/dist/InlineCommands/index.js +19 -11
  4. package/dist/Instance/Basic/index.d.ts +40 -0
  5. package/dist/Instance/Basic/index.js +43 -0
  6. package/dist/Instance/Basic/index.js.map +1 -0
  7. package/dist/Instance/BasicController/index.d.ts +40 -0
  8. package/dist/Instance/BasicController/index.js +43 -0
  9. package/dist/Instance/BasicController/index.js.map +1 -0
  10. package/dist/Instance/CommandHandler/index.d.ts +20 -0
  11. package/dist/Instance/CommandHandler/index.js +26 -0
  12. package/dist/Instance/CommandHandler/index.js.map +1 -0
  13. package/dist/Instance/Common/ResourceMap/index.js +17 -15
  14. package/dist/Instance/Common/UseFns/index.js +24 -19
  15. package/dist/Instance/Common/index.js +31 -9
  16. package/dist/Instance/Common/onEvent/index.js +82 -76
  17. package/dist/Instance/Common/onEvent/index.js.map +1 -1
  18. package/dist/Instance/GeneralHandler/index.d.ts +19 -0
  19. package/dist/Instance/GeneralHandler/index.js +49 -0
  20. package/dist/Instance/GeneralHandler/index.js.map +1 -0
  21. package/dist/Instance/GeneralModule/index.d.ts +1 -2
  22. package/dist/Instance/GeneralModule/index.js +83 -58
  23. package/dist/Instance/GeneralModule/index.js.map +1 -1
  24. package/dist/Instance/Handler/index.d.ts +23 -0
  25. package/dist/Instance/Handler/index.js +26 -0
  26. package/dist/Instance/Handler/index.js.map +1 -0
  27. package/dist/Instance/Proxy/index.d.ts +22 -0
  28. package/dist/Instance/Proxy/index.js +36 -0
  29. package/dist/Instance/Proxy/index.js.map +1 -0
  30. package/dist/Instance/index.d.ts +14 -0
  31. package/dist/Instance/index.js +20 -0
  32. package/dist/Instance/index.js.map +1 -0
  33. package/dist/Message/FromTemplate/index.js +53 -46
  34. package/dist/Message/PayloadCreation/Media.js +40 -36
  35. package/dist/Message/PayloadCreation/Media.js.map +1 -1
  36. package/dist/Message/PayloadCreation/React.js +11 -9
  37. package/dist/Message/PayloadCreation/Reply.js +37 -35
  38. package/dist/Message/PayloadCreation/Reply.js.map +1 -1
  39. package/dist/Message/PayloadCreation/ReplyWithSticker.d.ts +0 -0
  40. package/dist/Message/PayloadCreation/ReplyWithSticker.js +1 -0
  41. package/dist/Message/PayloadCreation/ReplyWithText.d.ts +2 -0
  42. package/dist/Message/PayloadCreation/ReplyWithText.js +15 -0
  43. package/dist/Message/PayloadCreation/deleteMessage.js +10 -8
  44. package/dist/Message/PayloadCreation/index.js +25 -17
  45. package/dist/Message/PayloadCreation/sendMessage.js +23 -21
  46. package/dist/Message/PayloadCreation/sendMessage.js.map +1 -1
  47. package/dist/Message/ProxiedMessage/index.d.ts +1 -1
  48. package/dist/Message/ProxiedMessage/index.js +17 -11
  49. package/dist/Message/RoutineCreation/AskResource/AskResourceApi/index.js +21 -16
  50. package/dist/Message/RoutineCreation/AskResource/index.js +58 -56
  51. package/dist/Message/RoutineCreation/DeleteMessage/index.js +18 -14
  52. package/dist/Message/RoutineCreation/Reply/WithMedia.js +32 -30
  53. package/dist/Message/RoutineCreation/Reply/WithSticke.d.ts +3 -0
  54. package/dist/Message/RoutineCreation/Reply/WithSticke.js +9 -0
  55. package/dist/Message/RoutineCreation/Reply/WithSticke.js.map +1 -0
  56. package/dist/Message/RoutineCreation/Reply/WithSticker.js +14 -8
  57. package/dist/Message/RoutineCreation/Reply/WithTemplate.js +15 -15
  58. package/dist/Message/RoutineCreation/Reply/index.js +25 -9
  59. package/dist/Message/RoutineCreation/SendMessage/index.js +25 -23
  60. package/dist/Message/RoutineCreation/SendMessage/index.js.map +1 -1
  61. package/dist/Message/RoutineCreation/reply.js +16 -14
  62. package/dist/Message/index.d.ts +1 -1
  63. package/dist/Message/index.js +49 -46
  64. package/dist/Message/kozz-md.parser/index.js +42 -92
  65. package/dist/Message/zap-md.parser/index.d.ts +1 -0
  66. package/dist/Message/zap-md.parser/index.js +2 -0
  67. package/dist/MessageTemplate/h.d.ts +3 -0
  68. package/dist/MessageTemplate/h.js +24 -0
  69. package/dist/MessageTemplate/h.js.map +1 -0
  70. package/dist/MessageTemplate/htm.d.ts +1 -0
  71. package/dist/MessageTemplate/htm.js +10 -0
  72. package/dist/MessageTemplate/htm.js.map +1 -0
  73. package/dist/MessageTemplate/renderer.d.ts +13 -0
  74. package/dist/MessageTemplate/renderer.js +62 -0
  75. package/dist/MessageTemplate/renderer.js.map +1 -0
  76. package/dist/MessageTemplate/types.d.ts +12 -0
  77. package/dist/MessageTemplate/types.js +5 -0
  78. package/dist/MessageTemplate/types.js.map +1 -0
  79. package/dist/Schema/index.js +11 -9
  80. package/dist/Socket/Events/Command.d.ts +3 -0
  81. package/dist/Socket/Events/Command.js +19 -0
  82. package/dist/Socket/Events/Command.js.map +1 -0
  83. package/dist/Socket/Events/Emit/ForwardEvent.js +19 -17
  84. package/dist/Socket/Events/Emit/Introduction.js +12 -10
  85. package/dist/Socket/Events/Emit/ProxyRequest.d.ts +0 -0
  86. package/dist/Socket/Events/Emit/ProxyRequest.js +2 -0
  87. package/dist/Socket/Events/Emit/ProxyRequest.js.map +1 -0
  88. package/dist/Socket/Events/Emit/RequestProxy.js +13 -10
  89. package/dist/Socket/Events/Emit/RevokeProxy.js +9 -7
  90. package/dist/Socket/Events/Handle/AskResource.js +27 -25
  91. package/dist/Socket/Events/Handle/Command.js +35 -38
  92. package/dist/Socket/Events/Handle/ProxiedMessage.js +11 -9
  93. package/dist/Socket/Events/Introduction.d.ts +3 -0
  94. package/dist/Socket/Events/Introduction.js +15 -0
  95. package/dist/Socket/Events/Introduction.js.map +1 -0
  96. package/dist/Socket/Events/ProxiedMessage.d.ts +2 -0
  97. package/dist/Socket/Events/ProxiedMessage.js +10 -0
  98. package/dist/Socket/Events/ProxiedMessage.js.map +1 -0
  99. package/dist/Socket/Messages/Command.d.ts +2 -0
  100. package/dist/Socket/Messages/Command.js +6 -0
  101. package/dist/Socket/Messages/Command.js.map +1 -0
  102. package/dist/Socket/Messages/Introduction.d.ts +3 -0
  103. package/dist/Socket/Messages/Introduction.js +15 -0
  104. package/dist/Socket/Messages/Introduction.js.map +1 -0
  105. package/dist/Socket/index.js +17 -15
  106. package/dist/StateMachine/index.js +44 -38
  107. package/dist/Validator/index.js +41 -38
  108. package/dist/debugIndex.d.ts +1 -0
  109. package/dist/debugIndex.js +73 -0
  110. package/dist/debugIndex.js.map +1 -0
  111. package/dist/index.d.ts +1 -0
  112. package/dist/index.js +47 -18
  113. package/dist/index.js.map +1 -1
  114. package/dist/jsx-runtime/MessageTemplating.js +51 -0
  115. package/dist/jsx-runtime/index.js +83 -0
  116. package/dist/messages.kozz.md +52 -0
  117. package/dist/util/index.js +63 -59
  118. package/dist/util/index.js.map +1 -1
  119. package/dist/util.d.ts +8 -0
  120. package/dist/util.js +36 -0
  121. package/dist/util.js.map +1 -0
  122. package/package.json +21 -17
  123. package/tsconfig.json +26 -97
  124. package/jest.config.ts +0 -196
  125. package/test.kozz.md +0 -81
@@ -1,47 +1,49 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replyWithMediaFromUrl = exports.replyWithMedia = exports.replyWithSticker = exports.replyWithText = void 0;
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
- body: string,
6
- boundaryId: messagePayload.boundaryId,
7
- chatId: messagePayload.to,
8
- contact: messagePayload.contact,
9
- platform: messagePayload.platform,
10
- timestamp: new Date().getTime(),
11
- quoteId: messagePayload.id,
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
- body: '',
16
- media: media,
17
- chatId: messagePayload.to,
18
- platform: 'WA',
19
- timestamp: new Date().getTime(),
20
- quoteId: messagePayload.id,
21
- boundaryId: messagePayload.boundaryId,
22
- contact: messagePayload.contact,
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
- body: caption || '',
27
- media: media,
28
- chatId: messagePayload.to,
29
- platform: 'WA',
30
- timestamp: new Date().getTime(),
31
- quoteId: messagePayload.id,
32
- boundaryId: messagePayload.boundaryId,
33
- contact: messagePayload.contact,
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
- body: caption || '',
38
- media: media,
39
- chatId: messagePayload.to,
40
- platform: 'WA',
41
- timestamp: new Date().getTime(),
42
- quoteId: messagePayload.id,
43
- boundaryId: messagePayload.boundaryId,
44
- contact: messagePayload.contact,
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,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,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"}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,2 @@
1
+ import { Command, SendMessagePayload } from 'kozz-types/dist';
2
+ export declare const replyWithText: (command: Command, string: string) => SendMessagePayload;
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
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
- return {
6
- boundaryName,
7
- messageId,
8
- localDelete: !!local,
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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
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
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Reply"), exports);
18
- __exportStar(require("./deleteMessage"), exports);
19
- //# sourceMappingURL=index.js.map
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
- Object.defineProperty(exports, "__esModule", { value: true });
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
- return {
6
- body,
7
- boundaryId: boundaryId,
8
- chatId: contactId,
9
- contact: {
10
- publicName: handlerName,
11
- privateName: handlerName,
12
- id: handlerName,
13
- isBlocked: false,
14
- hostAdded: true,
15
- isGroup: false,
16
- isHostAccount: true,
17
- },
18
- platform: 'WA',
19
- timestamp: new Date().getTime(),
20
- quoteId: undefined,
21
- media,
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,IAAI;QACd,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;QAC/B,OAAO,EAAE,SAAS;QAClB,KAAK;KACL,CAAC;AACH,CAAC,CAAC;AAzBW,QAAA,wBAAwB,4BAyBnC"}
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").Entity;
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
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.createProxiedMessageOject = void 0;
4
- const __1 = require("..");
5
- const RevokeProxy_1 = require("../../Socket/Events/Emit/RevokeProxy");
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
- const messageObject = (0, __1.createMessageObject)(socket, message, handlerName);
8
- const revoke = () => (0, RevokeProxy_1.revokeProxy)(socket, source);
9
- return {
10
- ...messageObject,
11
- revoke,
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
- Object.defineProperty(exports, "__esModule", { value: true });
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
- const requestId = `${requestData.responder.id}/${requestData.timestamp * 100 + Math.random() * 100}`;
13
- const requestPayload = {
14
- ...requestData,
15
- request: {
16
- ...requestData.request,
17
- id: requestId,
18
- },
19
- };
20
- socket.emit('ask_resource', requestPayload);
21
- return new Promise(resolve => {
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
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.createAskResource = void 0;
4
- const AskResourceApi_1 = require("./AskResourceApi");
7
+ var _AskResourceApi = require("./AskResourceApi");
5
8
  const createAskResource = (socket, args) => {
6
- const ask = async (askArgs) => {
7
- const response = await (0, AskResourceApi_1.ask)(socket, {
8
- request: askArgs.resource,
9
- responder: askArgs.responder,
10
- requester: args.requester,
11
- timestamp: new Date().getTime(),
12
- });
13
- return response;
14
- };
15
- ask.boundary = (boundaryId, resourceName, requestArgs = {}) => {
16
- return (0, AskResourceApi_1.ask)(socket, {
17
- request: {
18
- resource: resourceName,
19
- data: requestArgs,
20
- },
21
- requester: args.requester,
22
- timestamp: new Date().getTime(),
23
- responder: {
24
- id: boundaryId,
25
- type: 'Boundary',
26
- },
27
- });
28
- };
29
- ask.handler = (handlerId, resourceName, requestArgs = {}) => {
30
- return (0, AskResourceApi_1.ask)(socket, {
31
- request: {
32
- resource: resourceName,
33
- data: requestArgs,
34
- },
35
- requester: args.requester,
36
- timestamp: new Date().getTime(),
37
- responder: {
38
- id: handlerId,
39
- type: 'Handler',
40
- },
41
- });
42
- };
43
- ask.gateway = (resourceName, requestArgs = {}) => {
44
- return (0, AskResourceApi_1.ask)(socket, {
45
- request: {
46
- resource: resourceName,
47
- data: requestArgs,
48
- },
49
- requester: args.requester,
50
- timestamp: new Date().getTime(),
51
- responder: {
52
- id: 'Gateway',
53
- type: 'Gateway',
54
- },
55
- });
56
- };
57
- return ask;
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
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addSelfDeleteToMessages = exports.createSelfDelete = void 0;
4
- const PayloadCreation_1 = require("../../../Message/PayloadCreation");
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
- const deletePayload = (0, PayloadCreation_1.createDeleteMessagePayload)(messagePayload.boundaryName, messagePayload.id, localDelete);
7
- return socket.emit('delete_message', deletePayload);
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
- return {
12
- ...message,
13
- delete: (0, exports.createSelfDelete)(socket, message),
14
- quotedMessage: message.quotedMessage
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
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.withMedia = void 0;
4
- const PayloadCreation_1 = require("../../PayloadCreation");
5
- const Media_1 = require("../../PayloadCreation/Media");
7
+ var _PayloadCreation = require("../../PayloadCreation");
8
+ var _Media = require("../../PayloadCreation/Media");
6
9
  const withMedia = (socket, messagePayload) => {
7
- /**
8
- * Replies with a media
9
- * @param {Media} media
10
- * @param {string} caption
11
- */
12
- const replyMedia = (media, caption) => {
13
- socket.emit('reply_with_media', (0, PayloadCreation_1.replyWithMedia)(messagePayload, media, caption));
14
- };
15
- replyMedia.fromPath = async (path, mimeType, caption) => {
16
- const media = await (0, Media_1.loadMediaFromPath)(path, mimeType);
17
- replyMedia(media, caption);
18
- };
19
- replyMedia.fromBuffer = (buffer, mimeType, caption, fileName) => {
20
- const media = (0, Media_1.createMediaFromBuffer)(buffer, mimeType, fileName);
21
- replyMedia(media, caption);
22
- };
23
- replyMedia.fromB64 = (b64, mimeType, caption, fileName) => {
24
- const media = (0, Media_1.createMediaFromB64)(b64, mimeType, fileName);
25
- replyMedia(media, caption);
26
- };
27
- replyMedia.fromUrl = (url, mimeType, caption) => {
28
- const media = (0, Media_1.createMediaFromUrl)(url, mimeType);
29
- replyMedia(media, caption);
30
- };
31
- return replyMedia;
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,3 @@
1
+ import { Media, Command } from 'kozz-types/dist';
2
+ import { Socket } from 'socket.io-client';
3
+ export declare const withSticker: (socket: Socket, command: Command) => (media: Media) => void;
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.withSticker = void 0;
4
- const PayloadCreation_1 = require("../../PayloadCreation");
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
- socket.emit('reply_with_sticker', (0, PayloadCreation_1.replyWithSticker)(messagePayload, {
7
- ...media,
8
- stickerTags: tags,
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;