cetus-tools 1.4.1 → 1.4.2
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/dist/crud/SlackBotManager.d.ts +40 -0
- package/dist/crud/SlackBotManager.js +62 -0
- package/dist/crud/SlackBotManager.js.map +1 -0
- package/dist/crud/SlackChannelManager.d.ts +46 -0
- package/dist/crud/SlackChannelManager.js +66 -0
- package/dist/crud/SlackChannelManager.js.map +1 -0
- package/dist/crud/SlackTypes.d.ts +38 -0
- package/dist/crud/SlackTypes.js +28 -0
- package/dist/crud/SlackTypes.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
|
|
3
|
+
import { SlackBotStatus } from "./SlackTypes";
|
|
4
|
+
export interface ISlackBot {
|
|
5
|
+
botId?: number;
|
|
6
|
+
publicId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
purpose: string;
|
|
9
|
+
/** Cifrados en la base: la API no los devuelve, solo se envían al crear o cambiar. */
|
|
10
|
+
appToken?: string;
|
|
11
|
+
botToken?: string;
|
|
12
|
+
status: SlackBotStatus;
|
|
13
|
+
createdAt?: Date;
|
|
14
|
+
updatedAt?: Date;
|
|
15
|
+
config?: AxiosRequestConfig;
|
|
16
|
+
}
|
|
17
|
+
export interface ISlackBotSearchDetails {
|
|
18
|
+
botId?: number;
|
|
19
|
+
publicId?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
status?: string;
|
|
22
|
+
values?: ISlackBot[];
|
|
23
|
+
limit?: number;
|
|
24
|
+
offset?: number;
|
|
25
|
+
config?: AxiosRequestConfig;
|
|
26
|
+
}
|
|
27
|
+
export declare class SlackBotManager extends CrudServiceManager<ISlackBotSearchDetails, ISlackBot> {
|
|
28
|
+
private readonly baseUrl;
|
|
29
|
+
constructor(baseUrl: string);
|
|
30
|
+
find(details: ISlackBotSearchDetails): Promise<ISlackBot | undefined>;
|
|
31
|
+
findAll(details: ISlackBotSearchDetails): Promise<ISlackBot[] | undefined>;
|
|
32
|
+
findById(id: StandardIdRequestDefinition): Promise<ISlackBot | undefined>;
|
|
33
|
+
count(details: ISlackBotSearchDetails): Promise<number>;
|
|
34
|
+
create(details: ISlackBotSearchDetails): Promise<ISlackBot | undefined>;
|
|
35
|
+
/** El crud da de alta un bot por petición: se envía uno detrás de otro, en orden. */
|
|
36
|
+
createMany(details: ISlackBotSearchDetails): Promise<ISlackBot[] | undefined>;
|
|
37
|
+
modify(item: ISlackBot): Promise<ISlackBot | undefined>;
|
|
38
|
+
destroy(item: ISlackBot): Promise<void | number>;
|
|
39
|
+
private searchUrl;
|
|
40
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Cliente del registro de bots de Slack. Los dos tokens son credenciales: solo se envían al crear o
|
|
3
|
+
// cambiar, y la API no los devuelve. No hay borrado: un bot se deshabilita con su estado.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.SlackBotManager = void 0;
|
|
6
|
+
const itrm_tools_1 = require("itrm-tools");
|
|
7
|
+
const SlackTypes_1 = require("./SlackTypes");
|
|
8
|
+
class SlackBotManager extends itrm_tools_1.CrudServiceManager {
|
|
9
|
+
baseUrl;
|
|
10
|
+
constructor(baseUrl) {
|
|
11
|
+
super();
|
|
12
|
+
this.baseUrl = `${baseUrl}/slackBots`;
|
|
13
|
+
}
|
|
14
|
+
async find(details) {
|
|
15
|
+
// The CRUD's GET filters the internal id as `?id=`; `botId` is the field, not the parameter.
|
|
16
|
+
return this.sendFinding(`${this.baseUrl}?id=${details.botId}`, details.config);
|
|
17
|
+
}
|
|
18
|
+
async findAll(details) {
|
|
19
|
+
return this.sendAllFinding(this.searchUrl(details), details.config);
|
|
20
|
+
}
|
|
21
|
+
async findById(id) {
|
|
22
|
+
return this.sendFinding(`${this.baseUrl}?id=${id.id}`, id.config);
|
|
23
|
+
}
|
|
24
|
+
async count(details) {
|
|
25
|
+
return (await this.sendCounting(this.searchUrl(details), details.config)) ?? 0;
|
|
26
|
+
}
|
|
27
|
+
async create(details) {
|
|
28
|
+
return this.sendCreation(this.baseUrl, details, details.config);
|
|
29
|
+
}
|
|
30
|
+
/** El crud da de alta un bot por petición: se envía uno detrás de otro, en orden. */
|
|
31
|
+
async createMany(details) {
|
|
32
|
+
const created = [];
|
|
33
|
+
for (const value of details.values ?? []) {
|
|
34
|
+
const bot = await this.create({ ...value, config: details.config });
|
|
35
|
+
if (bot)
|
|
36
|
+
created.push(bot);
|
|
37
|
+
}
|
|
38
|
+
return created;
|
|
39
|
+
}
|
|
40
|
+
async modify(item) {
|
|
41
|
+
return this.sendModification(`${this.baseUrl}/${encodeURIComponent(item.publicId)}`, item, item.config);
|
|
42
|
+
}
|
|
43
|
+
async destroy(item) {
|
|
44
|
+
throw (0, SlackTypes_1.slackRouteNotSupported)(`borrado del bot ${item.publicId}: se deshabilita con su estado`);
|
|
45
|
+
}
|
|
46
|
+
searchUrl(details) {
|
|
47
|
+
const params = new URLSearchParams();
|
|
48
|
+
if (details.publicId)
|
|
49
|
+
params.set("publicId", details.publicId);
|
|
50
|
+
if (details.name)
|
|
51
|
+
params.set("name", details.name);
|
|
52
|
+
if (details.status)
|
|
53
|
+
params.set("status", details.status);
|
|
54
|
+
if (details.limit !== undefined)
|
|
55
|
+
params.set("limit", String(details.limit));
|
|
56
|
+
if (details.offset !== undefined)
|
|
57
|
+
params.set("offset", String(details.offset));
|
|
58
|
+
return `${this.baseUrl}?${params.toString()}`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.SlackBotManager = SlackBotManager;
|
|
62
|
+
//# sourceMappingURL=SlackBotManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sl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E,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAE/E,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IAClD,CAAC;CACJ"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
import { CrudServiceManager, StandardIdRequestDefinition } from "itrm-tools";
|
|
3
|
+
export interface ISlackChannel {
|
|
4
|
+
channelId?: number;
|
|
5
|
+
publicId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
/** Cifrado en la base: solo lo devuelve la ruta interna de resolución, nunca una lectura. */
|
|
8
|
+
webhook?: string;
|
|
9
|
+
strategyId?: number | null;
|
|
10
|
+
status: string;
|
|
11
|
+
createdAt?: Date;
|
|
12
|
+
updatedAt?: Date;
|
|
13
|
+
config?: AxiosRequestConfig;
|
|
14
|
+
}
|
|
15
|
+
export interface ISlackChannelSearchDetails {
|
|
16
|
+
channelId?: number;
|
|
17
|
+
publicId?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
strategyId?: number;
|
|
20
|
+
status?: string;
|
|
21
|
+
values?: ISlackChannel[];
|
|
22
|
+
limit?: number;
|
|
23
|
+
offset?: number;
|
|
24
|
+
config?: AxiosRequestConfig;
|
|
25
|
+
}
|
|
26
|
+
/** Lo que devuelve la ruta interna: el canal con su webhook descifrado. */
|
|
27
|
+
export interface IResolvedSlackChannel {
|
|
28
|
+
publicId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
webhook: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class SlackChannelManager extends CrudServiceManager<ISlackChannelSearchDetails, ISlackChannel> {
|
|
33
|
+
private readonly baseUrl;
|
|
34
|
+
constructor(baseUrl: string);
|
|
35
|
+
find(details: ISlackChannelSearchDetails): Promise<ISlackChannel | undefined>;
|
|
36
|
+
findAll(details: ISlackChannelSearchDetails): Promise<ISlackChannel[] | undefined>;
|
|
37
|
+
findById(id: StandardIdRequestDefinition): Promise<ISlackChannel | undefined>;
|
|
38
|
+
count(details: ISlackChannelSearchDetails): Promise<number>;
|
|
39
|
+
create(details: ISlackChannelSearchDetails): Promise<ISlackChannel | undefined>;
|
|
40
|
+
createMany(details: ISlackChannelSearchDetails): Promise<ISlackChannel[] | undefined>;
|
|
41
|
+
modify(item: ISlackChannel): Promise<ISlackChannel | undefined>;
|
|
42
|
+
destroy(item: ISlackChannel): Promise<void | number>;
|
|
43
|
+
/** La única llamada que trae el webhook descifrado; es la ruta interna del crud. */
|
|
44
|
+
resolveWebhook(publicId: string, config?: AxiosRequestConfig): Promise<IResolvedSlackChannel | undefined>;
|
|
45
|
+
private searchUrl;
|
|
46
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Cliente del crud de canales de Slack. El webhook es un secreto: la API nunca lo devuelve y solo la
|
|
3
|
+
// ruta interna de resolución lo descifra, justo antes de publicar. Lo que se lee no lo trae.
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.SlackChannelManager = void 0;
|
|
9
|
+
const axios_1 = __importDefault(require("axios"));
|
|
10
|
+
const itrm_tools_1 = require("itrm-tools");
|
|
11
|
+
class SlackChannelManager extends itrm_tools_1.CrudServiceManager {
|
|
12
|
+
baseUrl;
|
|
13
|
+
constructor(baseUrl) {
|
|
14
|
+
super();
|
|
15
|
+
this.baseUrl = `${baseUrl}/slackChannels`;
|
|
16
|
+
}
|
|
17
|
+
async find(details) {
|
|
18
|
+
// The CRUD's GET filters the internal id as `?id=`; `channelId` is only the path value.
|
|
19
|
+
return this.sendFinding(`${this.baseUrl}?id=${details.channelId}`, details.config);
|
|
20
|
+
}
|
|
21
|
+
async findAll(details) {
|
|
22
|
+
return this.sendAllFinding(this.searchUrl(details), details.config);
|
|
23
|
+
}
|
|
24
|
+
async findById(id) {
|
|
25
|
+
return this.sendFinding(`${this.baseUrl}?id=${id.id}`, id.config);
|
|
26
|
+
}
|
|
27
|
+
async count(details) {
|
|
28
|
+
return (await this.sendCounting(this.searchUrl(details), details.config)) ?? 0;
|
|
29
|
+
}
|
|
30
|
+
async create(details) {
|
|
31
|
+
return this.sendCreation(this.baseUrl, details, details.config);
|
|
32
|
+
}
|
|
33
|
+
async createMany(details) {
|
|
34
|
+
return this.sendCreationMany(this.baseUrl, details.values ?? [], details.config);
|
|
35
|
+
}
|
|
36
|
+
async modify(item) {
|
|
37
|
+
return this.sendModification(`${this.baseUrl}/${item.channelId}`, item, item.config);
|
|
38
|
+
}
|
|
39
|
+
async destroy(item) {
|
|
40
|
+
return this.sendDestruction(`${this.baseUrl}/${item.channelId}`, item.config);
|
|
41
|
+
}
|
|
42
|
+
/** La única llamada que trae el webhook descifrado; es la ruta interna del crud. */
|
|
43
|
+
async resolveWebhook(publicId, config) {
|
|
44
|
+
const response = await axios_1.default.get(`${this.baseUrl}/public/${encodeURIComponent(publicId)}`, config);
|
|
45
|
+
const body = response.data ?? {};
|
|
46
|
+
return body.payload?.item ?? body.item;
|
|
47
|
+
}
|
|
48
|
+
searchUrl(details) {
|
|
49
|
+
const params = new URLSearchParams();
|
|
50
|
+
if (details.publicId)
|
|
51
|
+
params.set("publicId", details.publicId);
|
|
52
|
+
if (details.name)
|
|
53
|
+
params.set("name", details.name);
|
|
54
|
+
if (details.strategyId !== undefined)
|
|
55
|
+
params.set("strategyId", String(details.strategyId));
|
|
56
|
+
if (details.status)
|
|
57
|
+
params.set("status", details.status);
|
|
58
|
+
if (details.limit !== undefined)
|
|
59
|
+
params.set("limit", String(details.limit));
|
|
60
|
+
if (details.offset !== undefined)
|
|
61
|
+
params.set("offset", String(details.offset));
|
|
62
|
+
return `${this.baseUrl}?${params.toString()}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.SlackChannelManager = SlackChannelManager;
|
|
66
|
+
//# sourceMappingURL=SlackChannelManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlackChannelManager.js","sourceRoot":"","sources":["../../src/crud/SlackChannelManager.ts"],"names":[],"mappings":";AAAA,qGAAqG;AACrG,6FAA6F;;;;;;AAE7F,kDAA6D;AAC7D,2CAA6E;AAkC7E,yBAAiC,SAAQ,+BAA6D;IACjF,OAAO,CAAS;IAEjC,YAAY,OAAe;QACvB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,GAAG,OAAO,gBAAgB,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,OAAmC;QACjD,wFAAwF;QACxF,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,OAAO,OAAO,OAAO,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACvF,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,OAAmC;QACpD,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,EAA+B;QACjD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,OAAO,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,OAAmC;QAClD,OAAO,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;IACnF,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,OAAmC;QACnD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC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AAI,CAAC,CAAC;QACnD,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3F,IAAI,OAAO,CAAC,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACzD,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5E,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAE/E,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IAClD,CAAC;CACJ"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ApiServiceError } from "itrm-tools";
|
|
2
|
+
export declare const SLACK_CHANNEL_STATUS: {
|
|
3
|
+
readonly ACTIVE: "active";
|
|
4
|
+
readonly DISABLED: "disabled";
|
|
5
|
+
};
|
|
6
|
+
export type SlackChannelStatus = (typeof SLACK_CHANNEL_STATUS)[keyof typeof SLACK_CHANNEL_STATUS];
|
|
7
|
+
export declare const SLACK_INBOX_STATUS: {
|
|
8
|
+
readonly PENDING: "pending";
|
|
9
|
+
readonly HANDLED: "handled";
|
|
10
|
+
};
|
|
11
|
+
export type SlackInboxStatus = (typeof SLACK_INBOX_STATUS)[keyof typeof SLACK_INBOX_STATUS];
|
|
12
|
+
export declare const SLACK_BOT_STATUS: {
|
|
13
|
+
readonly ACTIVE: "active";
|
|
14
|
+
readonly DISABLED: "disabled";
|
|
15
|
+
};
|
|
16
|
+
export type SlackBotStatus = (typeof SLACK_BOT_STATUS)[keyof typeof SLACK_BOT_STATUS];
|
|
17
|
+
/**
|
|
18
|
+
* La bandeja de menciones no es una entidad CRUD: sus rutas son listar, dar de alta y marcar
|
|
19
|
+
* atendida (el reclamo y la respuesta llegan con el bot). Por eso su tipo está aquí y su cliente no
|
|
20
|
+
* extiende `CrudServiceManager`: la mitad de las operaciones de esa base no tienen ruta todavía.
|
|
21
|
+
*/
|
|
22
|
+
export interface ISlackInbox {
|
|
23
|
+
eventId: string;
|
|
24
|
+
channelId: string;
|
|
25
|
+
threadTs: string;
|
|
26
|
+
authorId: string;
|
|
27
|
+
text: string;
|
|
28
|
+
status: SlackInboxStatus;
|
|
29
|
+
handledBy?: string | null;
|
|
30
|
+
handledAt?: Date | null;
|
|
31
|
+
createdAt?: Date;
|
|
32
|
+
updatedAt?: Date;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* El crud de Slack no tiene esa ruta (borrar un bot, borrar una entrada de la bandeja): se rechaza
|
|
36
|
+
* con un error tipado en vez de llamar a una ruta que no existe y devolver un 404 confuso.
|
|
37
|
+
*/
|
|
38
|
+
export declare function slackRouteNotSupported(operation: string): ApiServiceError;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Los valores de dominio de Slack que comparten las entidades (estados) y el rechazo de las
|
|
3
|
+
// operaciones que el crud de Slack no ofrece. Los tipos de cada entidad viven con su manager, como
|
|
4
|
+
// en el resto de la librería (StrategyTrackManager, AccountManager...).
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SLACK_BOT_STATUS = exports.SLACK_INBOX_STATUS = exports.SLACK_CHANNEL_STATUS = void 0;
|
|
7
|
+
exports.slackRouteNotSupported = slackRouteNotSupported;
|
|
8
|
+
const itrm_tools_1 = require("itrm-tools");
|
|
9
|
+
exports.SLACK_CHANNEL_STATUS = {
|
|
10
|
+
ACTIVE: "active",
|
|
11
|
+
DISABLED: "disabled",
|
|
12
|
+
};
|
|
13
|
+
exports.SLACK_INBOX_STATUS = {
|
|
14
|
+
PENDING: "pending",
|
|
15
|
+
HANDLED: "handled",
|
|
16
|
+
};
|
|
17
|
+
exports.SLACK_BOT_STATUS = {
|
|
18
|
+
ACTIVE: "active",
|
|
19
|
+
DISABLED: "disabled",
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* El crud de Slack no tiene esa ruta (borrar un bot, borrar una entrada de la bandeja): se rechaza
|
|
23
|
+
* con un error tipado en vez de llamar a una ruta que no existe y devolver un 404 confuso.
|
|
24
|
+
*/
|
|
25
|
+
function slackRouteNotSupported(operation) {
|
|
26
|
+
return new itrm_tools_1.ApiServiceError(itrm_tools_1.HttpCode.METHOD_NOT_ALLOWED, "METHOD_NOT_ALLOWED", `el crud de Slack no tiene ${operation}`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=SlackTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlackTypes.js","sourceRoot":"","sources":["../../src/crud/SlackTypes.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,mGAAmG;AACnG,wEAAwE;;;;AAExE,2CAAuD;AAE1C,QAAA,oBAAoB,GAAG;IAChC,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAIE,QAAA,kBAAkB,GAAG;IAC9B,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACZ,CAAC;AAIE,QAAA,gBAAgB,GAAG;IAC5B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAsBX;;;GAGG;AACH,gCAAuC,SAAiB;IACpD,OAAO,IAAI,4BAAe,CAAC,qBAAQ,CAAC,kBAAkB,EAAE,oBAAoB,EAAE,6BAA6B,SAAS,EAAE,CAAC,CAAC;AAC5H,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,4 +31,7 @@ export { MarketManager as MarketManager, IMarket as IMarket, IMarketSearchDetail
|
|
|
31
31
|
export { MarketOrderManager as MarketOrderManager, IMarketOrder as IMarketOrder, IMarketOrderSearchDetails as IMarketSearchDetails } from "./crud/MarketOrderManager";
|
|
32
32
|
export { EventStatManager as EventStatManager, IEventStat as IEventStat, IEventStatSearchDetails as IEventStatSearchDetails } from "./crud/EventStatManager";
|
|
33
33
|
export { IQuotation as IQuotation, IQuotationDetails as IQuotationDetails, QuotationManager as QuotationManager } from "./crud/QuotationManager";
|
|
34
|
+
export { SLACK_BOT_STATUS as SLACK_BOT_STATUS, SlackBotStatus as SlackBotStatus, SLACK_CHANNEL_STATUS as SLACK_CHANNEL_STATUS, SlackChannelStatus as SlackChannelStatus, SLACK_INBOX_STATUS as SLACK_INBOX_STATUS, SlackInboxStatus as SlackInboxStatus, ISlackInbox as ISlackInbox, slackRouteNotSupported as slackRouteNotSupported } from "./crud/SlackTypes";
|
|
35
|
+
export { SlackChannelManager as SlackChannelManager, ISlackChannel as ISlackChannel, ISlackChannelSearchDetails as ISlackChannelSearchDetails, IResolvedSlackChannel as IResolvedSlackChannel } from "./crud/SlackChannelManager";
|
|
36
|
+
export { SlackBotManager as SlackBotManager, ISlackBot as ISlackBot, ISlackBotSearchDetails as ISlackBotSearchDetails } from "./crud/SlackBotManager";
|
|
34
37
|
export * from "itrm-tools";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.QuotationManager = exports.EventStatManager = exports.MarketOrderManager = exports.MarketManager = exports.BalanceChangeManager = exports.CounterpartyBalancesManager = exports.TransactionManager = exports.StrategyTrackManager = exports.StrategyEarnManager = exports.StrategyOrderManager = exports.StrategyManager = exports.StrategyLogManager = exports.SourceManager = exports.RatesManager = exports.PnlManager = exports.PairsManager = exports.OperationsManager = exports.NavManager = exports.ModificationManager = exports.IntermediaryManager = exports.ExpenseManager = exports.ContributorManager = exports.ContributorActionManager = exports.AssetsManager = exports.AccountManager = exports.findBitsoBook = exports.findBalances = exports.BitsoApiConnection = exports.MatchedTransactionManager = exports.KycStatus = exports.ExpressLogableConfig = void 0;
|
|
17
|
+
exports.SlackBotManager = exports.SlackChannelManager = exports.slackRouteNotSupported = exports.SLACK_INBOX_STATUS = exports.SLACK_CHANNEL_STATUS = exports.SLACK_BOT_STATUS = exports.QuotationManager = exports.EventStatManager = exports.MarketOrderManager = exports.MarketManager = exports.BalanceChangeManager = exports.CounterpartyBalancesManager = exports.TransactionManager = exports.StrategyTrackManager = exports.StrategyEarnManager = exports.StrategyOrderManager = exports.StrategyManager = exports.StrategyLogManager = exports.SourceManager = exports.RatesManager = exports.PnlManager = exports.PairsManager = exports.OperationsManager = exports.NavManager = exports.ModificationManager = exports.IntermediaryManager = exports.ExpenseManager = exports.ContributorManager = exports.ContributorActionManager = exports.AssetsManager = exports.AccountManager = exports.findBitsoBook = exports.findBalances = exports.BitsoApiConnection = exports.MatchedTransactionManager = exports.KycStatus = exports.ExpressLogableConfig = void 0;
|
|
18
18
|
var ExpressLogableConfig_1 = require("./api/ExpressLogableConfig");
|
|
19
19
|
Object.defineProperty(exports, "ExpressLogableConfig", { enumerable: true, get: function () { return ExpressLogableConfig_1.ExpressLogableConfig; } });
|
|
20
20
|
var KycApiManager_1 = require("./api/external/KycApiManager");
|
|
@@ -77,6 +77,15 @@ var EventStatManager_1 = require("./crud/EventStatManager");
|
|
|
77
77
|
Object.defineProperty(exports, "EventStatManager", { enumerable: true, get: function () { return EventStatManager_1.EventStatManager; } });
|
|
78
78
|
var QuotationManager_1 = require("./crud/QuotationManager");
|
|
79
79
|
Object.defineProperty(exports, "QuotationManager", { enumerable: true, get: function () { return QuotationManager_1.QuotationManager; } });
|
|
80
|
+
var SlackTypes_1 = require("./crud/SlackTypes");
|
|
81
|
+
Object.defineProperty(exports, "SLACK_BOT_STATUS", { enumerable: true, get: function () { return SlackTypes_1.SLACK_BOT_STATUS; } });
|
|
82
|
+
Object.defineProperty(exports, "SLACK_CHANNEL_STATUS", { enumerable: true, get: function () { return SlackTypes_1.SLACK_CHANNEL_STATUS; } });
|
|
83
|
+
Object.defineProperty(exports, "SLACK_INBOX_STATUS", { enumerable: true, get: function () { return SlackTypes_1.SLACK_INBOX_STATUS; } });
|
|
84
|
+
Object.defineProperty(exports, "slackRouteNotSupported", { enumerable: true, get: function () { return SlackTypes_1.slackRouteNotSupported; } });
|
|
85
|
+
var SlackChannelManager_1 = require("./crud/SlackChannelManager");
|
|
86
|
+
Object.defineProperty(exports, "SlackChannelManager", { enumerable: true, get: function () { return SlackChannelManager_1.SlackChannelManager; } });
|
|
87
|
+
var SlackBotManager_1 = require("./crud/SlackBotManager");
|
|
88
|
+
Object.defineProperty(exports, "SlackBotManager", { enumerable: true, get: function () { return SlackBotManager_1.SlackBotManager; } });
|
|
80
89
|
// The services (cetus-app-strategy-crud, cetus-app-strategy, cetus-app-exernal-api) reach itrm-tools
|
|
81
90
|
// only through cetus-tools, so the whole chain runs one itrm-tools version, raised here. Names that
|
|
82
91
|
// cetus-tools defines itself (ExpressLogableConfig, KycStatus) keep the cetus-tools version: a
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mEAA0F;AAAjF,4HAAA,oBAAoB,OAAwB;AAErD,8DAAoH;AAA3G,0GAAA,SAAS,OAAa;AAE/B,gFAA4N;AAAnN,uIAAA,yBAAyB,OAA6B;AAC/D,qEAA4H;AAAjF,wHAAA,kBAAkB,OAAsB;AACnF,+DAA8G;AAArE,4GAAA,YAAY,OAAgB;AACrE,yDAAuG;AAApE,0GAAA,aAAa,OAAiB;AAIjE,wDAA+I;AAAtI,gHAAA,cAAc,OAAkB;AACzC,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