@webuildbots/webuildbots-sdk 11.1.1 → 11.2.0

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.
@@ -0,0 +1,26 @@
1
+ export declare enum AuditTypes {
2
+ EDIT_ENTITY = "EDIT_ENTITY",
3
+ CREATE_ENTITY = "CREATE_ENTITY",
4
+ DELETE_ENTITY = "DELETE_ENTITY",
5
+ EDIT_INTENT = "EDIT_INTENT",
6
+ CREATE_INTENT = "CREATE_INTENT",
7
+ DELETE_INTENT = "DELETE_INTENT",
8
+ CREATE_BUILD = "CREATE_BUILD",
9
+ DELETE_QUESTION = "DELETE_QUESTION",
10
+ COMPLETE_TAKEOVER = "COMPLETE_TAKEOVER",
11
+ EDIT_BLOCK = "EDIT_BLOCK",
12
+ CREATE_BLOCK = "CREATE_BLOCK",
13
+ DELETE_BLOCK = "DELETE_BLOCK",
14
+ CREATE_AGENT = "CREATE_AGENT",
15
+ EDIT_AGENT = "EDIT_AGENT",
16
+ DELETE_AGENT = "DELETE_AGENT",
17
+ CREATE_FORM = "CREATE_FORM",
18
+ EDIT_FORM = "EDIT_FORM",
19
+ DELETE_FORM = "DELETE_FORM",
20
+ START_TAKEOVER = "START_TAKEOVER",
21
+ GENERATE_UTTERANCES = "GENERATE_UTTERANCES",
22
+ CREATE_ENTITY_MAPPING = "CREATE_ENTITY_MAPPING",
23
+ DELETE_ENTITY_MAPPING = "DELETE_ENTITY_MAPPING",
24
+ CREATE_INTENT_MAPPING = "CREATE_INTENT_MAPPING",
25
+ DELETE_INTENT_MAPPING = "DELETE_INTENT_MAPPING"
26
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuditTypes = void 0;
4
+ var AuditTypes;
5
+ (function (AuditTypes) {
6
+ AuditTypes["EDIT_ENTITY"] = "EDIT_ENTITY";
7
+ AuditTypes["CREATE_ENTITY"] = "CREATE_ENTITY";
8
+ AuditTypes["DELETE_ENTITY"] = "DELETE_ENTITY";
9
+ AuditTypes["EDIT_INTENT"] = "EDIT_INTENT";
10
+ AuditTypes["CREATE_INTENT"] = "CREATE_INTENT";
11
+ AuditTypes["DELETE_INTENT"] = "DELETE_INTENT";
12
+ AuditTypes["CREATE_BUILD"] = "CREATE_BUILD";
13
+ AuditTypes["DELETE_QUESTION"] = "DELETE_QUESTION";
14
+ AuditTypes["COMPLETE_TAKEOVER"] = "COMPLETE_TAKEOVER";
15
+ AuditTypes["EDIT_BLOCK"] = "EDIT_BLOCK";
16
+ AuditTypes["CREATE_BLOCK"] = "CREATE_BLOCK";
17
+ AuditTypes["DELETE_BLOCK"] = "DELETE_BLOCK";
18
+ AuditTypes["CREATE_AGENT"] = "CREATE_AGENT";
19
+ AuditTypes["EDIT_AGENT"] = "EDIT_AGENT";
20
+ AuditTypes["DELETE_AGENT"] = "DELETE_AGENT";
21
+ AuditTypes["CREATE_FORM"] = "CREATE_FORM";
22
+ AuditTypes["EDIT_FORM"] = "EDIT_FORM";
23
+ AuditTypes["DELETE_FORM"] = "DELETE_FORM";
24
+ AuditTypes["START_TAKEOVER"] = "START_TAKEOVER";
25
+ AuditTypes["GENERATE_UTTERANCES"] = "GENERATE_UTTERANCES";
26
+ AuditTypes["CREATE_ENTITY_MAPPING"] = "CREATE_ENTITY_MAPPING";
27
+ AuditTypes["DELETE_ENTITY_MAPPING"] = "DELETE_ENTITY_MAPPING";
28
+ AuditTypes["CREATE_INTENT_MAPPING"] = "CREATE_INTENT_MAPPING";
29
+ AuditTypes["DELETE_INTENT_MAPPING"] = "DELETE_INTENT_MAPPING";
30
+ })(AuditTypes = exports.AuditTypes || (exports.AuditTypes = {}));
package/lib/index.d.ts CHANGED
@@ -24,5 +24,8 @@ import { WebhookRequest, WebhookResponse, ResponseUnitType, ResponseUnit, BlockP
24
24
  import LogicBB from './builder/block/logic-bb';
25
25
  import ImageBB from './builder/block/image-bb';
26
26
  import ResponseService from './services/ResponseService';
27
+ import EntityService from './services/EntityService';
27
28
  import IntentService from './services/IntentService';
28
- export { BlockBuilder, ComplexBB, FunctionBB, EmailFormTableBB, UnsetFormBB, MediaBB, ImageBB, SelectBB, TextBB, VideoBB, DevSwitchBB, LogicBB, BlockCB, ChoiceBuilder, DefinedCB, DefinedIB, ExtensionCB, LocationCB, PhoneCB, UrlCB, GalleryBB, BasicBB, ItemBuilder, WebhookResponse, WebhookRequest, ResponseUnit, ResponseUnitType, BlockPointer, ResponseBuilder, Client, JWTPayload, ResponseService, IntentService };
29
+ import AIService from './services/AIService';
30
+ import AuditService from './services/AuditService';
31
+ export { BlockBuilder, ComplexBB, FunctionBB, EmailFormTableBB, UnsetFormBB, MediaBB, ImageBB, SelectBB, TextBB, VideoBB, DevSwitchBB, LogicBB, BlockCB, ChoiceBuilder, DefinedCB, DefinedIB, ExtensionCB, LocationCB, PhoneCB, UrlCB, GalleryBB, BasicBB, ItemBuilder, WebhookResponse, WebhookRequest, ResponseUnit, ResponseUnitType, BlockPointer, ResponseBuilder, Client, JWTPayload, ResponseService, IntentService, EntityService, AIService, AuditService };
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.IntentService = exports.ResponseService = exports.ResponseBuilder = exports.ResponseUnitType = exports.ItemBuilder = exports.BasicBB = exports.GalleryBB = exports.UrlCB = exports.PhoneCB = exports.LocationCB = exports.ExtensionCB = exports.DefinedIB = exports.DefinedCB = exports.ChoiceBuilder = exports.BlockCB = exports.LogicBB = exports.DevSwitchBB = exports.VideoBB = exports.TextBB = exports.SelectBB = exports.ImageBB = exports.MediaBB = exports.UnsetFormBB = exports.EmailFormTableBB = exports.FunctionBB = exports.ComplexBB = exports.BlockBuilder = void 0;
6
+ exports.AuditService = exports.AIService = exports.EntityService = exports.IntentService = exports.ResponseService = exports.ResponseBuilder = exports.ResponseUnitType = exports.ItemBuilder = exports.BasicBB = exports.GalleryBB = exports.UrlCB = exports.PhoneCB = exports.LocationCB = exports.ExtensionCB = exports.DefinedIB = exports.DefinedCB = exports.ChoiceBuilder = exports.BlockCB = exports.LogicBB = exports.DevSwitchBB = exports.VideoBB = exports.TextBB = exports.SelectBB = exports.ImageBB = exports.MediaBB = exports.UnsetFormBB = exports.EmailFormTableBB = exports.FunctionBB = exports.ComplexBB = exports.BlockBuilder = void 0;
7
7
  var block_builder_1 = __importDefault(require("./builder/block/block-builder"));
8
8
  exports.BlockBuilder = block_builder_1.default;
9
9
  var basic_bb_1 = __importDefault(require("./builder/block/basic-bb"));
@@ -56,5 +56,11 @@ var image_bb_1 = __importDefault(require("./builder/block/image-bb"));
56
56
  exports.ImageBB = image_bb_1.default;
57
57
  var ResponseService_1 = __importDefault(require("./services/ResponseService"));
58
58
  exports.ResponseService = ResponseService_1.default;
59
+ var EntityService_1 = __importDefault(require("./services/EntityService"));
60
+ exports.EntityService = EntityService_1.default;
59
61
  var IntentService_1 = __importDefault(require("./services/IntentService"));
60
62
  exports.IntentService = IntentService_1.default;
63
+ var AIService_1 = __importDefault(require("./services/AIService"));
64
+ exports.AIService = AIService_1.default;
65
+ var AuditService_1 = __importDefault(require("./services/AuditService"));
66
+ exports.AuditService = AuditService_1.default;
@@ -0,0 +1,15 @@
1
+ import { BlockTypes } from '../const/block-enums';
2
+ export interface BlockFormState {
3
+ _id: string;
4
+ blockVersion: number;
5
+ blockId: string;
6
+ content: any;
7
+ created: string;
8
+ defaultChoice?: any;
9
+ function?: any;
10
+ group: string;
11
+ meta: any;
12
+ name: string;
13
+ type: BlockTypes.TEXT | BlockTypes.COMPLEX | BlockTypes.MEDIA | undefined;
14
+ version: number;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export default class AIService {
2
+ private apiService;
3
+ private client;
4
+ private GPT3_MODEL_NAME;
5
+ constructor(token: string, client: string, rootURL?: string);
6
+ buildModel(note: string, emailNotification: boolean): Promise<any>;
7
+ generateUtterances(utterances: string[], numAlternatives?: number, modelName?: string): Promise<any>;
8
+ getTasks(): Promise<any>;
9
+ }
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var ApiService_1 = __importDefault(require("./ApiService"));
43
+ var AIService = /** @class */ (function () {
44
+ function AIService(token, client, rootURL) {
45
+ this.GPT3_MODEL_NAME = 'text-davinci-003';
46
+ this.apiService = new ApiService_1.default(token, rootURL);
47
+ this.client = client;
48
+ }
49
+ AIService.prototype.buildModel = function (note, emailNotification) {
50
+ return __awaiter(this, void 0, void 0, function () {
51
+ var res, options, e_1;
52
+ return __generator(this, function (_a) {
53
+ switch (_a.label) {
54
+ case 0:
55
+ options = {
56
+ method: 'POST',
57
+ data: { note: note, emailNotification: emailNotification }
58
+ };
59
+ _a.label = 1;
60
+ case 1:
61
+ _a.trys.push([1, 3, , 4]);
62
+ return [4 /*yield*/, this.apiService.hitApi('api/agent/knowlbase/build-model', this.client, options)];
63
+ case 2:
64
+ res = _a.sent();
65
+ return [3 /*break*/, 4];
66
+ case 3:
67
+ e_1 = _a.sent();
68
+ throw Error(e_1);
69
+ case 4: return [2 /*return*/, res];
70
+ }
71
+ });
72
+ });
73
+ };
74
+ AIService.prototype.generateUtterances = function (utterances, numAlternatives, modelName) {
75
+ if (numAlternatives === void 0) { numAlternatives = 10; }
76
+ if (modelName === void 0) { modelName = this.GPT3_MODEL_NAME; }
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ var emptyArray, res, options, e_2;
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
81
+ case 0:
82
+ if (!utterances.length) {
83
+ emptyArray = [];
84
+ return [2 /*return*/, { data: { data: emptyArray } }];
85
+ }
86
+ options = {
87
+ method: 'POST',
88
+ data: { utterances: utterances, numAlternatives: numAlternatives, modelName: modelName }
89
+ };
90
+ _a.label = 1;
91
+ case 1:
92
+ _a.trys.push([1, 3, , 4]);
93
+ return [4 /*yield*/, this.apiService.hitApi('api/agent/knowlbase/generate-utterances', this.client, options)];
94
+ case 2:
95
+ res = _a.sent();
96
+ return [3 /*break*/, 4];
97
+ case 3:
98
+ e_2 = _a.sent();
99
+ throw Error(e_2);
100
+ case 4: return [2 /*return*/, res];
101
+ }
102
+ });
103
+ });
104
+ };
105
+ AIService.prototype.getTasks = function () {
106
+ return __awaiter(this, void 0, void 0, function () {
107
+ var res, options, e_3;
108
+ return __generator(this, function (_a) {
109
+ switch (_a.label) {
110
+ case 0:
111
+ options = {
112
+ method: 'GET',
113
+ };
114
+ _a.label = 1;
115
+ case 1:
116
+ _a.trys.push([1, 3, , 4]);
117
+ return [4 /*yield*/, this.apiService.hitApi('api/agent/knowlbase/build-tasks', this.client, options)];
118
+ case 2:
119
+ res = _a.sent();
120
+ return [3 /*break*/, 4];
121
+ case 3:
122
+ e_3 = _a.sent();
123
+ throw Error(e_3);
124
+ case 4: return [2 /*return*/, res];
125
+ }
126
+ });
127
+ });
128
+ };
129
+ return AIService;
130
+ }());
131
+ exports.default = AIService;
@@ -3,9 +3,17 @@ export default class ApiService {
3
3
  private baseURL;
4
4
  constructor(sdkToken: any, rootURL?: string);
5
5
  hitApi(endpoint: any, client: any, options: any): Promise<{
6
+ status: {
7
+ httpCode: number;
8
+ statusText: string;
9
+ };
6
10
  data: any;
7
11
  error: any;
8
12
  } | {
13
+ status: {
14
+ httpCode: any;
15
+ statusText: any;
16
+ };
9
17
  data: any;
10
18
  error: any;
11
19
  }>;
@@ -50,7 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
50
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
51
  };
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
- var cross_fetch_1 = __importDefault(require("cross-fetch"));
53
+ var axios_1 = __importDefault(require("axios"));
54
54
  var ApiService = /** @class */ (function () {
55
55
  function ApiService(sdkToken, rootURL) {
56
56
  if (rootURL === void 0) { rootURL = 'https://backend.logicdialog.ai'; }
@@ -59,29 +59,37 @@ var ApiService = /** @class */ (function () {
59
59
  this.baseURL = rootURL;
60
60
  }
61
61
  ApiService.prototype.hitApi = function (endpoint, client, options) {
62
+ var _a, _b;
62
63
  return __awaiter(this, void 0, void 0, function () {
63
- var response, data, error_1, errorResponse;
64
- return __generator(this, function (_a) {
65
- switch (_a.label) {
64
+ var headers, response, data, error_1, errorMessage;
65
+ var _c;
66
+ return __generator(this, function (_d) {
67
+ switch (_d.label) {
66
68
  case 0:
67
- _a.trys.push([0, 3, , 4]);
68
- return [4 /*yield*/, cross_fetch_1.default(this.baseURL + "/" + endpoint, __assign(__assign({}, options), { body: JSON.stringify(options.body), headers: __assign({ Authorization: 'Bearer ' + this.sdkToken, 'content-type': 'application/json', Accept: 'application/json', 'wbb-client': client }, options.headers) }))];
69
+ _d.trys.push([0, 2, , 3]);
70
+ headers = __assign((_c = { Authorization: 'Bearer ' + this.sdkToken, Accept: 'application/json', 'wbb-client': client, 'Access-Control-Allow-Origin': '*', origin: new URL(this.baseURL).origin }, _c['Content-Type'] = 'text/plain', _c), options.headers);
71
+ return [4 /*yield*/, axios_1.default(__assign(__assign({}, options), { url: this.baseURL + "/" + endpoint, headers: headers }))];
69
72
  case 1:
70
- response = _a.sent();
71
- if (!response.ok) {
72
- throw new Error("HTTP error " + response.status);
73
- }
74
- return [4 /*yield*/, response.json()];
73
+ response = _d.sent();
74
+ data = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.data) || response.data;
75
+ return [2 /*return*/, {
76
+ status: { httpCode: response.status, statusText: response.statusText },
77
+ data: data,
78
+ error: null
79
+ }];
75
80
  case 2:
76
- data = _a.sent();
77
- return [2 /*return*/, { data: data, error: null }];
78
- case 3:
79
- error_1 = _a.sent();
80
- errorResponse = {
81
- errorMessage: error_1
82
- };
83
- return [2 /*return*/, { data: null, error: error_1 || errorResponse }];
84
- case 4: return [2 /*return*/];
81
+ error_1 = _d.sent();
82
+ errorMessage = error_1.response
83
+ ? (_b = error_1.response.data) === null || _b === void 0 ? void 0 : _b.error : error_1.message;
84
+ return [2 /*return*/, {
85
+ status: {
86
+ httpCode: error_1.response.status,
87
+ statusText: error_1.response.statusText
88
+ },
89
+ data: null,
90
+ error: errorMessage
91
+ }];
92
+ case 3: return [2 /*return*/];
85
93
  }
86
94
  });
87
95
  });
@@ -0,0 +1,8 @@
1
+ import { AuditTypes } from '../const/audit-types';
2
+ export default class AIService {
3
+ private apiService;
4
+ private client;
5
+ constructor(token: string, client: string, rootURL?: string);
6
+ createAudit(type: AuditTypes, data: any, userId?: string): Promise<any>;
7
+ getAudit(type?: string, action?: string, from?: string, to?: string, artifact?: string): Promise<any>;
8
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var ApiService_1 = __importDefault(require("./ApiService"));
43
+ var AIService = /** @class */ (function () {
44
+ function AIService(token, client, rootURL) {
45
+ this.apiService = new ApiService_1.default(token, rootURL);
46
+ this.client = client;
47
+ }
48
+ AIService.prototype.createAudit = function (type, data, userId) {
49
+ return __awaiter(this, void 0, void 0, function () {
50
+ var res, options, e_1;
51
+ return __generator(this, function (_a) {
52
+ switch (_a.label) {
53
+ case 0:
54
+ options = {
55
+ method: 'POST',
56
+ data: { type: type, data: data, userId: userId }
57
+ };
58
+ _a.label = 1;
59
+ case 1:
60
+ _a.trys.push([1, 3, , 4]);
61
+ return [4 /*yield*/, this.apiService.hitApi('api/agent/audit', this.client, options)];
62
+ case 2:
63
+ res = _a.sent();
64
+ return [3 /*break*/, 4];
65
+ case 3:
66
+ e_1 = _a.sent();
67
+ throw Error(e_1);
68
+ case 4: return [2 /*return*/, res];
69
+ }
70
+ });
71
+ });
72
+ };
73
+ AIService.prototype.getAudit = function (type, action, from, to, artifact) {
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ var res, options, e_2;
76
+ return __generator(this, function (_a) {
77
+ switch (_a.label) {
78
+ case 0:
79
+ options = {
80
+ method: 'GET',
81
+ params: { type: type, action: action, from: from, to: to, artifact: artifact }
82
+ };
83
+ _a.label = 1;
84
+ case 1:
85
+ _a.trys.push([1, 3, , 4]);
86
+ return [4 /*yield*/, this.apiService.hitApi('api/agent/audit', this.client, options)];
87
+ case 2:
88
+ res = _a.sent();
89
+ return [3 /*break*/, 4];
90
+ case 3:
91
+ e_2 = _a.sent();
92
+ throw Error(e_2);
93
+ case 4: return [2 /*return*/, res];
94
+ }
95
+ });
96
+ });
97
+ };
98
+ return AIService;
99
+ }());
100
+ exports.default = AIService;
@@ -0,0 +1,24 @@
1
+ export default class EntityService {
2
+ private apiService;
3
+ private client;
4
+ constructor(token: string, client: string, rootURL?: string);
5
+ createEntity(title: string, values: Record<string, any>[], name: string, template?: string, module?: string, isWbbDocument?: boolean): Promise<any>;
6
+ updateEntity(_id: string, body: {
7
+ title?: string;
8
+ values?: Record<string, any>[];
9
+ name?: string;
10
+ created?: string;
11
+ template?: string;
12
+ module?: string;
13
+ isWbbDocument?: boolean;
14
+ }): Promise<any>;
15
+ getEntity(id: any): Promise<any>;
16
+ getEntities(searchText?: string): Promise<any>;
17
+ deleteEntity(_id: string): Promise<any>;
18
+ createMapping(block: {
19
+ blockId: string;
20
+ module?: string;
21
+ }, entityId: string): Promise<any>;
22
+ deleteMapping(_id: string): Promise<any>;
23
+ getMappings(responseId?: string): Promise<any>;
24
+ }