kozz-module-maker 0.2.3 → 0.2.4
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/bun.lock +617 -0
- package/dist/Instance/Common/ResourceMap/index.d.ts +1 -1
- package/dist/Instance/Common/UseFns/index.d.ts +1 -1
- package/dist/Instance/Common/index.d.ts +1 -1
- package/dist/Instance/GeneralModule/index.d.ts +7 -13
- package/dist/Message/PayloadCreation/Media.d.ts +1 -2
- package/dist/Message/PayloadCreation/React.d.ts +1 -1
- package/dist/Message/PayloadCreation/Reply.d.ts +1 -1
- package/dist/Message/PayloadCreation/sendMessage.d.ts +1 -1
- package/dist/Message/ProxiedMessage/index.d.ts +7 -15
- package/dist/Message/RoutineCreation/AskResource/index.d.ts +3 -3
- package/dist/Message/RoutineCreation/Reply/WithMedia.d.ts +0 -1
- package/dist/Message/RoutineCreation/reply.d.ts +5 -6
- package/dist/Message/index.d.ts +7 -15
- package/dist/index.d.ts +1 -1
- package/dist/jsx-runtime/MessageTemplating.d.ts +29 -0
- package/dist/jsx-runtime/index.d.ts +28 -0
- package/dist/util/index.d.ts +4 -5
- package/package.json +2 -2
- package/tsconfig.json +10 -2
- package/dist/InlineCommands/index.js.map +0 -1
- package/dist/Instance/Basic/index.d.ts +0 -40
- package/dist/Instance/Basic/index.js +0 -43
- package/dist/Instance/Basic/index.js.map +0 -1
- package/dist/Instance/BasicController/index.d.ts +0 -40
- package/dist/Instance/BasicController/index.js +0 -43
- package/dist/Instance/BasicController/index.js.map +0 -1
- package/dist/Instance/CommandHandler/index.d.ts +0 -20
- package/dist/Instance/CommandHandler/index.js +0 -26
- package/dist/Instance/CommandHandler/index.js.map +0 -1
- package/dist/Instance/Common/ResourceMap/index.js.map +0 -1
- package/dist/Instance/Common/UseFns/index.js.map +0 -1
- package/dist/Instance/Common/index.js.map +0 -1
- package/dist/Instance/Common/onEvent/index.js.map +0 -1
- package/dist/Instance/GeneralHandler/index.d.ts +0 -19
- package/dist/Instance/GeneralHandler/index.js +0 -49
- package/dist/Instance/GeneralHandler/index.js.map +0 -1
- package/dist/Instance/GeneralModule/index.js.map +0 -1
- package/dist/Instance/Handler/index.d.ts +0 -23
- package/dist/Instance/Handler/index.js +0 -26
- package/dist/Instance/Handler/index.js.map +0 -1
- package/dist/Instance/Proxy/index.d.ts +0 -22
- package/dist/Instance/Proxy/index.js +0 -36
- package/dist/Instance/Proxy/index.js.map +0 -1
- package/dist/Instance/index.d.ts +0 -14
- package/dist/Instance/index.js +0 -20
- package/dist/Instance/index.js.map +0 -1
- package/dist/Message/FromTemplate/index.js.map +0 -1
- package/dist/Message/PayloadCreation/Media.js.map +0 -1
- package/dist/Message/PayloadCreation/React.js.map +0 -1
- package/dist/Message/PayloadCreation/Reply.js.map +0 -1
- package/dist/Message/PayloadCreation/ReplyWithSticker.d.ts +0 -0
- package/dist/Message/PayloadCreation/ReplyWithSticker.js +0 -1
- package/dist/Message/PayloadCreation/ReplyWithText.d.ts +0 -2
- package/dist/Message/PayloadCreation/ReplyWithText.js +0 -15
- package/dist/Message/PayloadCreation/deleteMessage.js.map +0 -1
- package/dist/Message/PayloadCreation/index.js.map +0 -1
- package/dist/Message/PayloadCreation/sendMessage.js.map +0 -1
- package/dist/Message/ProxiedMessage/index.js.map +0 -1
- package/dist/Message/RoutineCreation/AskResource/AskResourceApi/index.js.map +0 -1
- package/dist/Message/RoutineCreation/AskResource/index.js.map +0 -1
- package/dist/Message/RoutineCreation/DeleteMessage/index.js.map +0 -1
- package/dist/Message/RoutineCreation/Reply/WithMedia.js.map +0 -1
- package/dist/Message/RoutineCreation/Reply/WithSticke.d.ts +0 -3
- package/dist/Message/RoutineCreation/Reply/WithSticke.js +0 -9
- package/dist/Message/RoutineCreation/Reply/WithSticke.js.map +0 -1
- package/dist/Message/RoutineCreation/Reply/WithSticker.js.map +0 -1
- package/dist/Message/RoutineCreation/Reply/WithTemplate.js.map +0 -1
- package/dist/Message/RoutineCreation/Reply/index.js.map +0 -1
- package/dist/Message/RoutineCreation/SendMessage/index.js.map +0 -1
- package/dist/Message/RoutineCreation/reply.js.map +0 -1
- package/dist/Message/index.js.map +0 -1
- package/dist/Message/kozz-md.parser/index.js.map +0 -1
- package/dist/Message/zap-md.parser/index.d.ts +0 -1
- package/dist/Message/zap-md.parser/index.js +0 -2
- package/dist/MessageTemplate/h.d.ts +0 -3
- package/dist/MessageTemplate/h.js +0 -24
- package/dist/MessageTemplate/h.js.map +0 -1
- package/dist/MessageTemplate/htm.d.ts +0 -1
- package/dist/MessageTemplate/htm.js +0 -10
- package/dist/MessageTemplate/htm.js.map +0 -1
- package/dist/MessageTemplate/renderer.d.ts +0 -13
- package/dist/MessageTemplate/renderer.js +0 -62
- package/dist/MessageTemplate/renderer.js.map +0 -1
- package/dist/MessageTemplate/types.d.ts +0 -12
- package/dist/MessageTemplate/types.js +0 -5
- package/dist/MessageTemplate/types.js.map +0 -1
- package/dist/Schema/index.js.map +0 -1
- package/dist/Socket/Events/Command.d.ts +0 -3
- package/dist/Socket/Events/Command.js +0 -19
- package/dist/Socket/Events/Command.js.map +0 -1
- package/dist/Socket/Events/Emit/ForwardEvent.js.map +0 -1
- package/dist/Socket/Events/Emit/Introduction.js.map +0 -1
- package/dist/Socket/Events/Emit/ProxyRequest.d.ts +0 -0
- package/dist/Socket/Events/Emit/ProxyRequest.js +0 -2
- package/dist/Socket/Events/Emit/ProxyRequest.js.map +0 -1
- package/dist/Socket/Events/Emit/RequestProxy.js.map +0 -1
- package/dist/Socket/Events/Emit/RevokeProxy.js.map +0 -1
- package/dist/Socket/Events/Handle/AskResource.js.map +0 -1
- package/dist/Socket/Events/Handle/Command.js.map +0 -1
- package/dist/Socket/Events/Handle/ProxiedMessage.js.map +0 -1
- package/dist/Socket/Events/Introduction.d.ts +0 -3
- package/dist/Socket/Events/Introduction.js +0 -15
- package/dist/Socket/Events/Introduction.js.map +0 -1
- package/dist/Socket/Events/ProxiedMessage.d.ts +0 -2
- package/dist/Socket/Events/ProxiedMessage.js +0 -10
- package/dist/Socket/Events/ProxiedMessage.js.map +0 -1
- package/dist/Socket/Messages/Command.d.ts +0 -2
- package/dist/Socket/Messages/Command.js +0 -6
- package/dist/Socket/Messages/Command.js.map +0 -1
- package/dist/Socket/Messages/Introduction.d.ts +0 -3
- package/dist/Socket/Messages/Introduction.js +0 -15
- package/dist/Socket/Messages/Introduction.js.map +0 -1
- package/dist/Socket/index.js.map +0 -1
- package/dist/StateMachine/index.js.map +0 -1
- package/dist/Validator/index.js.map +0 -1
- package/dist/debugIndex.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/util/index.js.map +0 -1
- package/dist/util.d.ts +0 -8
- package/dist/util.js +0 -36
- package/dist/util.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Method, TypeString } from '../../Schema';
|
|
2
|
-
import { ProxiedMessageObject } from '../../Message/ProxiedMessage';
|
|
3
|
-
import { Source } from 'kozz-types';
|
|
1
|
+
import type { Method, TypeString } from '../../Schema';
|
|
2
|
+
import { type ProxiedMessageObject } from '../../Message/ProxiedMessage';
|
|
3
|
+
import { type Source } from 'kozz-types';
|
|
4
4
|
export type ControllerInitParams<Methods extends Record<string, TypeString>> = {
|
|
5
5
|
name: string;
|
|
6
6
|
address: string;
|
|
@@ -30,25 +30,19 @@ export declare const createModule: <Methods extends Record<string, TypeString>>(
|
|
|
30
30
|
};
|
|
31
31
|
resources: {
|
|
32
32
|
removeResource: (name: string) => void;
|
|
33
|
-
upsertResource: (name: string, getter: (args:
|
|
33
|
+
upsertResource: (name: string, getter: (args: import("kozz-types").AskResourcePayload["request"]["data"]) => any) => void;
|
|
34
34
|
};
|
|
35
35
|
proxy: {
|
|
36
36
|
revoke: () => void;
|
|
37
37
|
};
|
|
38
38
|
ask: {
|
|
39
39
|
(askArgs: {
|
|
40
|
-
resource: Omit<
|
|
41
|
-
|
|
42
|
-
resource: string;
|
|
43
|
-
data: Record<string, any>;
|
|
44
|
-
}, "id">;
|
|
45
|
-
responder: {
|
|
46
|
-
id: string;
|
|
47
|
-
type: import("kozz-types").EntityType;
|
|
48
|
-
};
|
|
40
|
+
resource: Omit<import("kozz-types").AskResourcePayload["request"], "id">;
|
|
41
|
+
responder: import("kozz-types").AskResourcePayload["responder"];
|
|
49
42
|
}): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
50
43
|
boundary(boundaryId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
51
44
|
handler(handlerId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
52
45
|
gateway(resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
53
46
|
};
|
|
47
|
+
socket: import("socket.io-client").Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
54
48
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Media } from 'kozz-types';
|
|
1
|
+
import { type Media } from 'kozz-types';
|
|
3
2
|
export type MimeType = 'video/mp4' | 'image/gif' | 'image' | 'video' | 'video/mpeg' | 'audio/webm';
|
|
4
3
|
export declare const loadMediaFromPath: (filePath: string, mimeType: MimeType, stickerTags?: string[]) => Promise<Media>;
|
|
5
4
|
export declare const createMediaFromBuffer: (buffer: Buffer, mimeType: MimeType, fileName?: string, stickerTags?: string[]) => Media;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MessageReceivedByGateway } from 'kozz-types';
|
|
1
|
+
import type { MessageReceivedByGateway } from 'kozz-types';
|
|
2
2
|
import { Socket } from 'socket.io-client';
|
|
3
3
|
export declare const createReact: (socket: Socket, messagePayload: MessageReceivedByGateway) => (emote: string) => Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Media, MessageReceivedByGateway, SendMessagePayload } from 'kozz-types';
|
|
1
|
+
import type { Media, MessageReceivedByGateway, SendMessagePayload } from 'kozz-types';
|
|
2
2
|
export declare const replyWithText: (messagePayload: MessageReceivedByGateway, string: string) => SendMessagePayload;
|
|
3
3
|
export declare const replyWithSticker: (messagePayload: MessageReceivedByGateway, media: Media) => SendMessagePayload;
|
|
4
4
|
export declare const replyWithMedia: (messagePayload: MessageReceivedByGateway, media: Media, caption?: string) => SendMessagePayload;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Media, SendMessagePayload } from 'kozz-types';
|
|
1
|
+
import type { Media, SendMessagePayload } from 'kozz-types';
|
|
2
2
|
export declare const createSendMessagePayload: (handlerName: string, contactId: string, boundaryId: string, body: string, media?: Media) => SendMessagePayload;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Command, MessageReceivedByGateway, Source } from 'kozz-types';
|
|
3
2
|
import { Socket } from 'socket.io-client';
|
|
4
3
|
export type ProxiedMessageObject = ReturnType<typeof createProxiedMessageOject>;
|
|
@@ -6,15 +5,8 @@ export declare const createProxiedMessageOject: (socket: Socket, source: Source,
|
|
|
6
5
|
revoke: () => void;
|
|
7
6
|
ask: {
|
|
8
7
|
(askArgs: {
|
|
9
|
-
resource: Omit<
|
|
10
|
-
|
|
11
|
-
resource: string;
|
|
12
|
-
data: Record<string, any>;
|
|
13
|
-
}, "id">;
|
|
14
|
-
responder: {
|
|
15
|
-
id: string;
|
|
16
|
-
type: import("kozz-types").EntityType;
|
|
17
|
-
};
|
|
8
|
+
resource: Omit<import("kozz-types").AskResourcePayload["request"], "id">;
|
|
9
|
+
responder: import("kozz-types").AskResourcePayload["responder"];
|
|
18
10
|
}): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
19
11
|
boundary(boundaryId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
20
12
|
handler(handlerId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
@@ -32,11 +24,11 @@ export declare const createProxiedMessageOject: (socket: Socket, source: Source,
|
|
|
32
24
|
withSticker: (media: import("kozz-types").Media, tags?: string[]) => void;
|
|
33
25
|
withTemplate: (templateName: string, templateData?: Record<string, any>) => void;
|
|
34
26
|
withMedia: {
|
|
35
|
-
(media: import("kozz-types").Media, caption?: string
|
|
36
|
-
fromPath(path: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string
|
|
37
|
-
fromBuffer(buffer: Buffer, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string
|
|
38
|
-
fromB64(b64: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string
|
|
39
|
-
fromUrl(url: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string
|
|
27
|
+
(media: import("kozz-types").Media, caption?: string): void;
|
|
28
|
+
fromPath(path: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string): Promise<void>;
|
|
29
|
+
fromBuffer(buffer: Buffer, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string, fileName?: string): void;
|
|
30
|
+
fromB64(b64: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string, fileName?: string): void;
|
|
31
|
+
fromUrl(url: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string): void;
|
|
40
32
|
};
|
|
41
33
|
};
|
|
42
34
|
};
|
|
@@ -9,8 +9,8 @@ type AskResourceArgs = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const createAskResource: (socket: Socket, args: RequestResourceArgs) => {
|
|
11
11
|
(askArgs: AskResourceArgs): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
12
|
-
boundary(boundaryId: string, resourceName: string, requestArgs?: AskResourceArgs[
|
|
13
|
-
handler(handlerId: string, resourceName: string, requestArgs?: AskResourceArgs[
|
|
14
|
-
gateway(resourceName: string, requestArgs?: AskResourceArgs[
|
|
12
|
+
boundary(boundaryId: string, resourceName: string, requestArgs?: AskResourceArgs["resource"]["data"]): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
13
|
+
handler(handlerId: string, resourceName: string, requestArgs?: AskResourceArgs["resource"]["data"]): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
14
|
+
gateway(resourceName: string, requestArgs?: AskResourceArgs["resource"]["data"]): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
15
15
|
};
|
|
16
16
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { MessageReceivedByGateway } from 'kozz-types';
|
|
3
2
|
import { Socket } from 'socket.io-client';
|
|
4
3
|
export declare const createReply: (socket: Socket, messagePayload: MessageReceivedByGateway, templatePath?: string) => {
|
|
@@ -6,10 +5,10 @@ export declare const createReply: (socket: Socket, messagePayload: MessageReceiv
|
|
|
6
5
|
withSticker: (media: import("kozz-types").Media, tags?: string[]) => void;
|
|
7
6
|
withTemplate: (templateName: string, templateData?: Record<string, any>) => void;
|
|
8
7
|
withMedia: {
|
|
9
|
-
(media: import("kozz-types").Media, caption?: string
|
|
10
|
-
fromPath(path: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string
|
|
11
|
-
fromBuffer(buffer: Buffer, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string
|
|
12
|
-
fromB64(b64: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string
|
|
13
|
-
fromUrl(url: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string
|
|
8
|
+
(media: import("kozz-types").Media, caption?: string): void;
|
|
9
|
+
fromPath(path: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string): Promise<void>;
|
|
10
|
+
fromBuffer(buffer: Buffer, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string, fileName?: string): void;
|
|
11
|
+
fromB64(b64: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string, fileName?: string): void;
|
|
12
|
+
fromUrl(url: string, mimeType: import("../PayloadCreation/Media").MimeType, caption?: string): void;
|
|
14
13
|
};
|
|
15
14
|
};
|
package/dist/Message/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Command, MessageReceivedByGateway } from 'kozz-types';
|
|
3
2
|
import { Socket } from 'socket.io-client';
|
|
4
3
|
export * from './FromTemplate';
|
|
@@ -6,15 +5,8 @@ export type MessageObj = ReturnType<typeof createMessageObject>;
|
|
|
6
5
|
export declare const createMessageObject: (socket: Socket, messagePayload: MessageReceivedByGateway, handlerId: string, templatePath?: string, command?: Command) => {
|
|
7
6
|
ask: {
|
|
8
7
|
(askArgs: {
|
|
9
|
-
resource: Omit<
|
|
10
|
-
|
|
11
|
-
resource: string;
|
|
12
|
-
data: Record<string, any>;
|
|
13
|
-
}, "id">;
|
|
14
|
-
responder: {
|
|
15
|
-
id: string;
|
|
16
|
-
type: import("kozz-types").EntityType;
|
|
17
|
-
};
|
|
8
|
+
resource: Omit<import("kozz-types").AskResourcePayload["request"], "id">;
|
|
9
|
+
responder: import("kozz-types").AskResourcePayload["responder"];
|
|
18
10
|
}): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
19
11
|
boundary(boundaryId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
20
12
|
handler(handlerId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
@@ -32,11 +24,11 @@ export declare const createMessageObject: (socket: Socket, messagePayload: Messa
|
|
|
32
24
|
withSticker: (media: import("kozz-types").Media, tags?: string[]) => void;
|
|
33
25
|
withTemplate: (templateName: string, templateData?: Record<string, any>) => void;
|
|
34
26
|
withMedia: {
|
|
35
|
-
(media: import("kozz-types").Media, caption?: string
|
|
36
|
-
fromPath(path: string, mimeType: import("./PayloadCreation/Media").MimeType, caption?: string
|
|
37
|
-
fromBuffer(buffer: Buffer, mimeType: import("./PayloadCreation/Media").MimeType, caption?: string
|
|
38
|
-
fromB64(b64: string, mimeType: import("./PayloadCreation/Media").MimeType, caption?: string
|
|
39
|
-
fromUrl(url: string, mimeType: import("./PayloadCreation/Media").MimeType, caption?: string
|
|
27
|
+
(media: import("kozz-types").Media, caption?: string): void;
|
|
28
|
+
fromPath(path: string, mimeType: import("./PayloadCreation/Media").MimeType, caption?: string): Promise<void>;
|
|
29
|
+
fromBuffer(buffer: Buffer, mimeType: import("./PayloadCreation/Media").MimeType, caption?: string, fileName?: string): void;
|
|
30
|
+
fromB64(b64: string, mimeType: import("./PayloadCreation/Media").MimeType, caption?: string, fileName?: string): void;
|
|
31
|
+
fromUrl(url: string, mimeType: import("./PayloadCreation/Media").MimeType, caption?: string): void;
|
|
40
32
|
};
|
|
41
33
|
};
|
|
42
34
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Component } from '.';
|
|
2
|
+
export declare const Bold: Component<{}>;
|
|
3
|
+
export declare const Code: Component<{}>;
|
|
4
|
+
export declare const Line: Component<{}>;
|
|
5
|
+
export declare const Monospace: Component<{}>;
|
|
6
|
+
export declare const Stroke: Component<{}>;
|
|
7
|
+
export declare const Italic: Component<{}>;
|
|
8
|
+
export declare const List: ({ items }: {
|
|
9
|
+
items: string | string[];
|
|
10
|
+
}) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Conditionally renders it's children if the prop 'when' evaluates to true
|
|
13
|
+
* @param param0
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare const Render: Component<{
|
|
17
|
+
when: boolean | (() => boolean);
|
|
18
|
+
}>;
|
|
19
|
+
type ForEachProps<TData> = {
|
|
20
|
+
data: Readonly<TData[]>;
|
|
21
|
+
render: (data: TData, index: number) => Component<any>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Iterates over an array and renders a component for each item.
|
|
25
|
+
* @param props
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare const ForEach: <TData extends any>(props: ForEachProps<TData>) => string[];
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type Primitive = string | number;
|
|
2
|
+
export type Nullable = null | undefined | boolean;
|
|
3
|
+
export type Child = VNode<any> | Primitive | Nullable | Child[];
|
|
4
|
+
export type Component<P = {}> = (props: P & {
|
|
5
|
+
children?: Child;
|
|
6
|
+
}) => Child;
|
|
7
|
+
export type Type<P = any> = string | symbol | Component<P>;
|
|
8
|
+
export interface VNode<P = any> {
|
|
9
|
+
type: Type<P>;
|
|
10
|
+
props: (P & {
|
|
11
|
+
children?: Child;
|
|
12
|
+
}) | {
|
|
13
|
+
children?: Child;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export type IntrinsicRenderer<P = any> = (props: P, children: string) => string;
|
|
17
|
+
export type IntrinsicsMap = Record<string, IntrinsicRenderer<any>>;
|
|
18
|
+
export interface RenderOptions {
|
|
19
|
+
intrinsics?: IntrinsicsMap;
|
|
20
|
+
}
|
|
21
|
+
export declare const Fragment: unique symbol;
|
|
22
|
+
export declare function createElement<P>(type: Type<P>, props: (P & {
|
|
23
|
+
children?: Child;
|
|
24
|
+
}) | null, ...children: Child[]): VNode<P>;
|
|
25
|
+
export declare function jsx<P>(type: Type<P>, props: P | null, key?: string | number): string;
|
|
26
|
+
export declare const jsxs: typeof jsx;
|
|
27
|
+
export declare function jsxDEV<P>(type: Type<P>, props: P | null, key?: string | number, _isStaticChildren?: boolean, _source?: any, _self?: any): VNode<P>;
|
|
28
|
+
export * from './MessageTemplating';
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { UseFn } from '../Instance/Common';
|
|
1
|
+
import { type Command } from 'kozz-types';
|
|
2
|
+
import { type UseFn } from '../Instance/Common';
|
|
4
3
|
export declare const runUse: (useArr: UseFn[], args: Command) => Command;
|
|
5
4
|
export declare function normalizeString(string: string): string;
|
|
6
5
|
export declare const randomId: () => string;
|
|
7
6
|
export declare const signPayload: <T extends Record<string, any>>(payload: T, signature?: string) => Promise<T & {
|
|
8
|
-
signature: Buffer;
|
|
7
|
+
signature: Buffer & void;
|
|
9
8
|
}> | (T & {
|
|
10
9
|
signature: string;
|
|
11
10
|
});
|
|
@@ -21,5 +20,5 @@ export declare const signInBrowser: <T extends Record<string, any>>(payload: T)
|
|
|
21
20
|
* @returns
|
|
22
21
|
*/
|
|
23
22
|
export declare const signInNodeEnvironment: <T extends Record<string, any>>(payload: T) => Promise<T & {
|
|
24
|
-
signature: Buffer;
|
|
23
|
+
signature: Buffer & void;
|
|
25
24
|
}>;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kozz-module-maker",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Library to create new module for the Kozz-Bot protocol",
|
|
5
5
|
"main": "./dist",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "babel ./src --out-dir ./dist --extensions .ts,.tsx --copy-files",
|
|
9
9
|
"dev": "npm run build -- --watch & nodemon --watch dist --exec 'npm run dist/debugIndex.js'",
|
|
10
|
-
"publish": "tsc && bun run build &&
|
|
10
|
+
"publish": "tsc && bun run build && npm publish"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"typescript": "^5.9.2"
|
package/tsconfig.json
CHANGED
|
@@ -7,12 +7,19 @@
|
|
|
7
7
|
"moduleDetection": "force",
|
|
8
8
|
"jsx": "preserve",
|
|
9
9
|
"allowJs": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
|
|
12
|
+
"rootDir": "./src",
|
|
13
|
+
"baseUrl": ".",
|
|
14
|
+
"paths": {
|
|
15
|
+
"src/*": ["src/*"]
|
|
16
|
+
},
|
|
10
17
|
|
|
11
18
|
// Bundler mode
|
|
12
19
|
"moduleResolution": "bundler",
|
|
13
20
|
// "verbatimModuleSyntax": true,
|
|
14
|
-
"noEmit": true,
|
|
15
21
|
"outDir": "dist",
|
|
22
|
+
"emitDeclarationOnly": true,
|
|
16
23
|
|
|
17
24
|
// Best practices
|
|
18
25
|
"strict": true,
|
|
@@ -25,5 +32,6 @@
|
|
|
25
32
|
"noUnusedLocals": false,
|
|
26
33
|
"noUnusedParameters": false,
|
|
27
34
|
"noPropertyAccessFromIndexSignature": false
|
|
28
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"exclude": ["./scripts/*", "./dist/*"]
|
|
29
37
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/InlineCommands/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAC7B,WAAmB,EACnB,OAA4B,EAAE,EAC7B,EAAE;IACH,OAAO,IAAI,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAClD,CAAC,CAAC;AALW,QAAA,cAAc,kBAKzB;AAEF;;;GAGG;AACI,MAAM,SAAS,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAA,sBAAc,EAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAA9D,QAAA,SAAS,aAAqD;AAE3E;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAE,EAAE,CAChD,IAAA,sBAAc,EAAC,kBAAkB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAD/B,QAAA,kBAAkB,sBACa;AAErC,MAAM,WAAW,GAAG,CAAC,SAAmB,EAAE,EAAE,EAAE,CACpD,IAAA,sBAAc,EAAC,aAAa,EAAE;IAC7B,MAAM;CACN,CAAC,CAAC;AAHS,QAAA,WAAW,eAGpB"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
type BasicControllerInitParams = {
|
|
2
|
-
name: string;
|
|
3
|
-
address: string;
|
|
4
|
-
templatePath?: string;
|
|
5
|
-
signature?: string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Creates a basic Handler Controller
|
|
9
|
-
* @param param0
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export declare const createBasicController: ({ address, name, templatePath, signature, }: BasicControllerInitParams) => {
|
|
13
|
-
sendMessage: {
|
|
14
|
-
(contactId: string, boundaryId: string, body: string): void;
|
|
15
|
-
withMedia(contactId: string, boundaryId: string, caption: string, media: import("kozz-types").Media): void;
|
|
16
|
-
};
|
|
17
|
-
use: (useFn: UseFn) => any;
|
|
18
|
-
removeResource: (name: string) => void;
|
|
19
|
-
upsertResource: (name: string, getter: (args: Record<string, any>) => any) => void;
|
|
20
|
-
listenToBoundary: (boundaryId: string) => {
|
|
21
|
-
when: (eventName: string, callback: (payload: any) => any) => void;
|
|
22
|
-
};
|
|
23
|
-
ask: {
|
|
24
|
-
(askArgs: {
|
|
25
|
-
resource: Omit<{
|
|
26
|
-
id: `${string}/${number}`;
|
|
27
|
-
resource: string;
|
|
28
|
-
data: Record<string, any>;
|
|
29
|
-
}, "id">;
|
|
30
|
-
responder: {
|
|
31
|
-
id: string;
|
|
32
|
-
type: import("kozz-types").Entity;
|
|
33
|
-
};
|
|
34
|
-
}): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
35
|
-
boundary(boundaryId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
36
|
-
handler(handlerId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
37
|
-
gateway(resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBasicController = void 0;
|
|
4
|
-
const Socket_1 = require("../../Socket");
|
|
5
|
-
const AskResource_1 = require("../../Socket/Events/Handle/AskResource");
|
|
6
|
-
const Common_1 = require("../Common/");
|
|
7
|
-
const AskResource_2 = require("../../Message/RoutineCreation/AskResource");
|
|
8
|
-
const SendMessage_1 = require("../../Message/RoutineCreation/SendMessage");
|
|
9
|
-
const ForwardEvent_1 = require("src/Socket/Events/Emit/ForwardEvent");
|
|
10
|
-
/**
|
|
11
|
-
* Creates a basic Handler Controller
|
|
12
|
-
* @param param0
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
const createBasicController = ({ address, name, templatePath, signature, }) => {
|
|
16
|
-
const { moduleUseFns, use } = (0, Common_1.createUseFns)(() => instance);
|
|
17
|
-
const { socket } = (0, Socket_1.connect)(address, moduleUseFns, templatePath || '', name, {}, [], signature);
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
const { removeResource, resourceMap, upsertResource } = (0, Common_1.createResourceMap)();
|
|
20
|
-
(0, AskResource_1.onAskResource)(socket, resourceMap);
|
|
21
|
-
const ask = (0, AskResource_2.createAskResource)(socket, {
|
|
22
|
-
requester: {
|
|
23
|
-
id: name,
|
|
24
|
-
type: 'Handler',
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
/**
|
|
28
|
-
* Routine to send message to any given boundary
|
|
29
|
-
*/
|
|
30
|
-
const sendMessage = (0, SendMessage_1.sendMessageToContact)(socket, name);
|
|
31
|
-
const listenToBoundary = (0, ForwardEvent_1.listenBoundary)(socket, name);
|
|
32
|
-
const instance = {
|
|
33
|
-
sendMessage,
|
|
34
|
-
use,
|
|
35
|
-
removeResource,
|
|
36
|
-
upsertResource,
|
|
37
|
-
listenToBoundary,
|
|
38
|
-
ask,
|
|
39
|
-
};
|
|
40
|
-
return instance;
|
|
41
|
-
};
|
|
42
|
-
exports.createBasicController = createBasicController;
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Instance/Basic/index.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AACvC,wEAAuE;AACvE,uCAA6D;AAC7D,2EAA8E;AAC9E,2EAAiF;AACjF,sEAAqE;AASrE;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,EACrC,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,GACkB,EAAE,EAAE;IAC/B,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,IAAA,qBAAY,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;IAE3D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gBAAO,EACzB,OAAO,EACP,YAAY,EACZ,YAAY,IAAI,EAAE,EAClB,IAAI,EACJ,EAAE,EACF,EAAE,EACF,SAAS,CACT,CAAC;IACF,aAAa;IACb,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAA,0BAAiB,GAAE,CAAC;IAC5E,IAAA,2BAAa,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEnC,MAAM,GAAG,GAAG,IAAA,+BAAiB,EAAC,MAAM,EAAE;QACrC,SAAS,EAAE;YACV,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,SAAS;SACf;KACD,CAAC,CAAC;IAEH;;OAEG;IACH,MAAM,WAAW,GAAG,IAAA,kCAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEvD,MAAM,gBAAgB,GAAG,IAAA,6BAAc,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEtD,MAAM,QAAQ,GAAG;QAChB,WAAW;QACX,GAAG;QACH,cAAc;QACd,cAAc;QACd,gBAAgB;QAChB,GAAG;KACH,CAAC;IAEF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AA7CW,QAAA,qBAAqB,yBA6ChC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
type BasicControllerInitParams = {
|
|
2
|
-
name: string;
|
|
3
|
-
address: string;
|
|
4
|
-
templatePath?: string;
|
|
5
|
-
signature?: string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Creates a basic Handler Controller
|
|
9
|
-
* @param param0
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export declare const createBasicController: ({ address, name, templatePath, signature, }: BasicControllerInitParams) => {
|
|
13
|
-
sendMessage: {
|
|
14
|
-
(contactId: string, boundaryId: string, body: string): void;
|
|
15
|
-
withMedia(contactId: string, boundaryId: string, caption: string, media: import("kozz-types").Media): void;
|
|
16
|
-
};
|
|
17
|
-
use: (useFn: import("../Common/UseFns").UseFn) => any;
|
|
18
|
-
removeResource: (name: string) => void;
|
|
19
|
-
upsertResource: (name: string, getter: (args: Record<string, any>) => any) => void;
|
|
20
|
-
listenToBoundary: (boundaryId: string) => {
|
|
21
|
-
when: (eventName: string, callback: (payload: any) => any) => void;
|
|
22
|
-
};
|
|
23
|
-
ask: {
|
|
24
|
-
(askArgs: {
|
|
25
|
-
resource: Omit<{
|
|
26
|
-
id: `${string}/${number}`;
|
|
27
|
-
resource: string;
|
|
28
|
-
data: Record<string, any>;
|
|
29
|
-
}, "id">;
|
|
30
|
-
responder: {
|
|
31
|
-
id: string;
|
|
32
|
-
type: import("kozz-types").Entity;
|
|
33
|
-
};
|
|
34
|
-
}): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
35
|
-
boundary(boundaryId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
36
|
-
handler(handlerId: string, resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
37
|
-
gateway(resourceName: string, requestArgs?: Record<string, any>): Promise<import("kozz-types").ProvideResourcePayload>;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBasicController = void 0;
|
|
4
|
-
const Socket_1 = require("../../Socket");
|
|
5
|
-
const AskResource_1 = require("../../Socket/Events/Handle/AskResource");
|
|
6
|
-
const Common_1 = require("../Common/");
|
|
7
|
-
const AskResource_2 = require("../../Message/RoutineCreation/AskResource");
|
|
8
|
-
const SendMessage_1 = require("../../Message/RoutineCreation/SendMessage");
|
|
9
|
-
const ForwardEvent_1 = require("src/Socket/Events/Emit/ForwardEvent");
|
|
10
|
-
/**
|
|
11
|
-
* Creates a basic Handler Controller
|
|
12
|
-
* @param param0
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
const createBasicController = ({ address, name, templatePath, signature, }) => {
|
|
16
|
-
const { moduleUseFns, use } = (0, Common_1.createUseFns)(() => instance);
|
|
17
|
-
const { socket } = (0, Socket_1.connect)(address, moduleUseFns, templatePath || '', name, {}, [], signature);
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
const { removeResource, resourceMap, upsertResource } = (0, Common_1.createResourceMap)();
|
|
20
|
-
(0, AskResource_1.onAskResource)(socket, resourceMap);
|
|
21
|
-
const ask = (0, AskResource_2.createAskResource)(socket, {
|
|
22
|
-
requester: {
|
|
23
|
-
id: name,
|
|
24
|
-
type: 'Handler',
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
/**
|
|
28
|
-
* Routine to send message to any given boundary
|
|
29
|
-
*/
|
|
30
|
-
const sendMessage = (0, SendMessage_1.sendMessageToContact)(socket, name);
|
|
31
|
-
const listenToBoundary = (0, ForwardEvent_1.listenBoundary)(socket, name);
|
|
32
|
-
const instance = {
|
|
33
|
-
sendMessage,
|
|
34
|
-
use,
|
|
35
|
-
removeResource,
|
|
36
|
-
upsertResource,
|
|
37
|
-
listenToBoundary,
|
|
38
|
-
ask,
|
|
39
|
-
};
|
|
40
|
-
return instance;
|
|
41
|
-
};
|
|
42
|
-
exports.createBasicController = createBasicController;
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Instance/BasicController/index.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AACvC,wEAAuE;AACvE,uCAA6D;AAC7D,2EAA8E;AAC9E,2EAAiF;AACjF,sEAAqE;AASrE;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,EACrC,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,GACkB,EAAE,EAAE;IAC/B,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,IAAA,qBAAY,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;IAE3D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gBAAO,EACzB,OAAO,EACP,YAAY,EACZ,YAAY,IAAI,EAAE,EAClB,IAAI,EACJ,EAAE,EACF,EAAE,EACF,SAAS,CACT,CAAC;IACF,aAAa;IACb,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAA,0BAAiB,GAAE,CAAC;IAC5E,IAAA,2BAAa,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEnC,MAAM,GAAG,GAAG,IAAA,+BAAiB,EAAC,MAAM,EAAE;QACrC,SAAS,EAAE;YACV,EAAE,EAAE,IAAI;YACR,IAAI,EAAE,SAAS;SACf;KACD,CAAC,CAAC;IAEH;;OAEG;IACH,MAAM,WAAW,GAAG,IAAA,kCAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEvD,MAAM,gBAAgB,GAAG,IAAA,6BAAc,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEtD,MAAM,QAAQ,GAAG;QAChB,WAAW;QACX,GAAG;QACH,cAAc;QACd,cAAc;QACd,gBAAgB;QAChB,GAAG;KACH,CAAC;IAEF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AA7CW,QAAA,qBAAqB,yBA6ChC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Method, TypeString } from '../../Schema';
|
|
2
|
-
export type HandlerInitParams<Methods extends Record<string, TypeString>> = {
|
|
3
|
-
name: string;
|
|
4
|
-
address: string;
|
|
5
|
-
methods: Record<string, Method<Methods>>;
|
|
6
|
-
boundariesToHandle: string[];
|
|
7
|
-
templatePath?: string;
|
|
8
|
-
signature?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const createHandlerInstance: <Methods extends Record<string, TypeString>>({ address, methods, name, templatePath, signature, boundariesToHandle, }: HandlerInitParams<Methods>) => {
|
|
11
|
-
use: (useFn: import("../Common/UseFns").UseFn) => any;
|
|
12
|
-
sendMessage: {
|
|
13
|
-
(contactId: string, boundaryId: string, body: string): void;
|
|
14
|
-
withMedia(contactId: string, boundaryId: string, caption: string, media: import("kozz-types").Media): void;
|
|
15
|
-
};
|
|
16
|
-
resources: {
|
|
17
|
-
removeResource: (name: string) => void;
|
|
18
|
-
upsertResource: (name: string, getter: (args: Record<string, any>) => any) => void;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createHandlerInstance = void 0;
|
|
4
|
-
const Socket_1 = require("../../Socket");
|
|
5
|
-
const AskResource_1 = require("../../Socket/Events/Handle/AskResource");
|
|
6
|
-
const Common_1 = require("../Common/");
|
|
7
|
-
const SendMessage_1 = require("../../Message/RoutineCreation/SendMessage");
|
|
8
|
-
const createHandlerInstance = ({ address, methods, name, templatePath, signature, boundariesToHandle, }) => {
|
|
9
|
-
const { moduleUseFns, use } = (0, Common_1.createUseFns)(() => instance);
|
|
10
|
-
const { socket, registerMethods } = (0, Socket_1.connect)(address, moduleUseFns, templatePath || '', name, methods, boundariesToHandle, signature);
|
|
11
|
-
registerMethods(methods);
|
|
12
|
-
const { removeResource, resourceMap, upsertResource } = (0, Common_1.createResourceMap)();
|
|
13
|
-
(0, AskResource_1.onAskResource)(socket, resourceMap);
|
|
14
|
-
const sendMessage = (0, SendMessage_1.sendMessageToContact)(socket, name);
|
|
15
|
-
const instance = {
|
|
16
|
-
use,
|
|
17
|
-
sendMessage,
|
|
18
|
-
resources: {
|
|
19
|
-
removeResource,
|
|
20
|
-
upsertResource,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
return instance;
|
|
24
|
-
};
|
|
25
|
-
exports.createHandlerInstance = createHandlerInstance;
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Instance/CommandHandler/index.ts"],"names":[],"mappings":";;;AACA,yCAAuC;AACvC,wEAAuE;AACvE,uCAAsE;AACtE,2EAAiF;AAW1E,MAAM,qBAAqB,GAAG,CAEnC,EACD,OAAO,EACP,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,kBAAkB,GACU,EAAE,EAAE;IAChC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,IAAA,qBAAY,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;IAE3D,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAA,gBAAO,EAC1C,OAAO,EACP,YAAY,EACZ,YAAY,IAAI,EAAE,EAClB,IAAI,EACJ,OAAO,EACP,kBAAkB,EAClB,SAAS,CACT,CAAC;IAEF,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAA,0BAAiB,GAAE,CAAC;IAE5E,IAAA,2BAAa,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEnC,MAAM,WAAW,GAAG,IAAA,kCAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEvD,MAAM,QAAQ,GAAG;QAChB,GAAG;QACH,WAAW;QACX,SAAS,EAAE;YACV,cAAc;YACd,cAAc;SACd;KACD,CAAC;IAEF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAxCW,QAAA,qBAAqB,yBAwChC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Instance/Common/ResourceMap/index.ts"],"names":[],"mappings":";;;AASO,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACrC,MAAM,WAAW,GAAgB,EAAE,CAAC;IAEpC,MAAM,cAAc,GAAG,CAAC,IAAkB,EAAE,MAAsB,EAAE,EAAE;QACrE,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,IAAkB,EAAE,EAAE;QAC7C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO;QACN,WAAW;QACX,cAAc;QACd,cAAc;KACd,CAAC;AACH,CAAC,CAAC;AAhBW,QAAA,iBAAiB,qBAgB5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Instance/Common/UseFns/index.ts"],"names":[],"mappings":";;;AASO,MAAM,YAAY,GAAG,CAAC,cAAmC,EAAE,EAAE;IACnE,MAAM,YAAY,GAAY,EAAE,CAAC;IAEjC;;;;;OAKG;IACH,MAAM,GAAG,GAAG,CAAC,KAAY,EAAE,EAAE;QAC5B,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,OAAO,cAAc,EAAE,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO;QACN,YAAY;QACZ,GAAG;KACH,CAAC;AACH,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Instance/Common/index.ts"],"names":[],"mappings":";;;AAAA,6CAAkD;AAAzC,gHAAA,iBAAiB,OAAA;AAC1B,mCAA+C;AAA/B,sGAAA,YAAY,OAAA;AAC5B,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Instance/Common/onEvent/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Method, TypeString } from '../../Schema';
|
|
2
|
-
import { ProxiedMessageObject } from '../../Message/ProxiedMessage';
|
|
3
|
-
import { Source } from 'kozz-types';
|
|
4
|
-
export type ControllerInitParams<Methods extends Record<string, TypeString>> = {
|
|
5
|
-
name: string;
|
|
6
|
-
address: string;
|
|
7
|
-
templatePath?: string;
|
|
8
|
-
signature?: string;
|
|
9
|
-
commands?: {
|
|
10
|
-
boundariesToHandle: string[];
|
|
11
|
-
methods?: Record<string, Method<Methods>>;
|
|
12
|
-
};
|
|
13
|
-
proxy?: {
|
|
14
|
-
source: Source;
|
|
15
|
-
destinationOverride?: string;
|
|
16
|
-
onMessage: (message: ProxiedMessageObject) => any;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export declare const createController: <Methods extends Record<string, TypeString>>({ name, address, commands, proxy, signature, templatePath, }: ControllerInitParams<Methods>) => void;
|