@or-sdk/contacts 4.3.2-beta.2616.0 → 4.3.2-beta.2634.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.
- package/dist/cjs/Contacts.js +0 -2
- package/dist/cjs/Contacts.js.map +1 -1
- package/dist/cjs/__tests__/contacts-error-handling.spec.js +1 -1
- package/dist/cjs/__tests__/db-mismatch-callback.spec.js +1 -1
- package/dist/cjs/__tests__/poll-migration.spec.js +1 -1
- package/dist/cjs/__tests__/poll-migration.spec.js.map +1 -1
- package/dist/cjs/__tests__/utils.spec.js +1 -1
- package/dist/cjs/api/baseWithPolingApi.js +6 -6
- package/dist/cjs/api/baseWithPolingApi.js.map +1 -1
- package/dist/cjs/api/batchProcessApi.js +1 -1
- package/dist/cjs/api/batchProcessApi.js.map +1 -1
- package/dist/cjs/api/bulkContactsCreateApi.js +65 -56
- package/dist/cjs/api/bulkContactsCreateApi.js.map +1 -1
- package/dist/cjs/api/contactApi.js +12 -12
- package/dist/cjs/api/contactApi.js.map +1 -1
- package/dist/cjs/api/contactBookApi.js.map +1 -1
- package/dist/cjs/api/fieldSchemaApi.js +1 -1
- package/dist/cjs/api/fieldSchemaApi.js.map +1 -1
- package/dist/cjs/api/fieldValueApi.js.map +1 -1
- package/dist/cjs/api/migrationsApi.js +1 -1
- package/dist/cjs/api/migrationsApi.js.map +1 -1
- package/dist/cjs/api/sharedBookContactPermissionApi.js.map +1 -1
- package/dist/cjs/apiError.js.map +1 -1
- package/dist/cjs/baseConfigFactory.js.map +1 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/Contacts.js +0 -2
- package/dist/esm/Contacts.js.map +1 -1
- package/dist/esm/__tests__/poll-migration.spec.js.map +1 -1
- package/dist/esm/__tests__/utils.spec.js.map +1 -1
- package/dist/esm/api/baseWithPolingApi.js +3 -3
- package/dist/esm/api/baseWithPolingApi.js.map +1 -1
- package/dist/esm/api/batchProcessApi.js.map +1 -1
- package/dist/esm/api/bulkContactsCreateApi.js +24 -19
- package/dist/esm/api/bulkContactsCreateApi.js.map +1 -1
- package/dist/esm/api/contactApi.js +6 -6
- package/dist/esm/api/contactApi.js.map +1 -1
- package/dist/esm/api/fieldSchemaApi.js.map +1 -1
- package/dist/esm/api/migrationsApi.js.map +1 -1
- package/dist/esm/baseConfigFactory.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/types/Contacts.d.ts +0 -2
- package/dist/types/Contacts.d.ts.map +1 -1
- package/dist/types/types.d.ts +17 -17
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/Contacts.ts +0 -3
- package/dist/cjs/api/administrationApi.js +0 -154
- package/dist/cjs/api/administrationApi.js.map +0 -1
- package/dist/esm/api/administrationApi.js +0 -77
- package/dist/esm/api/administrationApi.js.map +0 -1
- package/dist/types/api/administrationApi.d.ts +0 -15
- package/dist/types/api/administrationApi.d.ts.map +0 -1
- package/src/api/administrationApi.ts +0 -72
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
-
};
|
|
56
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
var uuid_1 = require("uuid");
|
|
58
|
-
var baseWithPolingApi_1 = __importDefault(require("./baseWithPolingApi"));
|
|
59
|
-
var utils_1 = require("../utils");
|
|
60
|
-
var AdministrationApi = (function (_super) {
|
|
61
|
-
__extends(AdministrationApi, _super);
|
|
62
|
-
function AdministrationApi(apiCall, batchProcessApi) {
|
|
63
|
-
var _this = _super.call(this, apiCall, batchProcessApi) || this;
|
|
64
|
-
_this.apiCall = apiCall;
|
|
65
|
-
_this.batchProcessApi = batchProcessApi;
|
|
66
|
-
_this.apiBasePath = 'admin';
|
|
67
|
-
return _this;
|
|
68
|
-
}
|
|
69
|
-
AdministrationApi.prototype.getIndicesStatus = function () {
|
|
70
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
return __generator(this, function (_a) {
|
|
72
|
-
return [2, this.apiCall({
|
|
73
|
-
method: 'GET',
|
|
74
|
-
route: "".concat(this.apiBasePath, "/status"),
|
|
75
|
-
})];
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
AdministrationApi.prototype.isSystemBusy = function () {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
return [2, this.apiCall({
|
|
83
|
-
method: 'GET',
|
|
84
|
-
route: "".concat(this.apiBasePath, "/busy"),
|
|
85
|
-
})];
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
AdministrationApi.prototype.addIndex = function (dbIndex) {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
-
var batchId, _1;
|
|
92
|
-
var _this = this;
|
|
93
|
-
return __generator(this, function (_a) {
|
|
94
|
-
switch (_a.label) {
|
|
95
|
-
case 0:
|
|
96
|
-
batchId = (0, uuid_1.v4)();
|
|
97
|
-
this.apiCall({
|
|
98
|
-
method: 'POST',
|
|
99
|
-
route: "".concat(this.apiBasePath, "/index"),
|
|
100
|
-
data: {
|
|
101
|
-
batchId: batchId,
|
|
102
|
-
index: dbIndex,
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
_a.label = 1;
|
|
106
|
-
case 1:
|
|
107
|
-
_a.trys.push([1, 3, , 4]);
|
|
108
|
-
return [4, (0, utils_1.debouncePromise)(function () { return _this.polling(batchId); }, 3000)];
|
|
109
|
-
case 2:
|
|
110
|
-
_a.sent();
|
|
111
|
-
return [2, true];
|
|
112
|
-
case 3:
|
|
113
|
-
_1 = _a.sent();
|
|
114
|
-
return [3, 4];
|
|
115
|
-
case 4: return [2, false];
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
AdministrationApi.prototype.dropIndex = function (dbIndex) {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
-
var batchId, _2;
|
|
123
|
-
var _this = this;
|
|
124
|
-
return __generator(this, function (_a) {
|
|
125
|
-
switch (_a.label) {
|
|
126
|
-
case 0:
|
|
127
|
-
batchId = (0, uuid_1.v4)();
|
|
128
|
-
this.apiCall({
|
|
129
|
-
method: 'DELETE',
|
|
130
|
-
route: "".concat(this.apiBasePath, "/index"),
|
|
131
|
-
data: {
|
|
132
|
-
batchId: batchId,
|
|
133
|
-
index: dbIndex,
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
_a.label = 1;
|
|
137
|
-
case 1:
|
|
138
|
-
_a.trys.push([1, 3, , 4]);
|
|
139
|
-
return [4, (0, utils_1.debouncePromise)(function () { return _this.polling(batchId); }, 3000)];
|
|
140
|
-
case 2:
|
|
141
|
-
_a.sent();
|
|
142
|
-
return [2, true];
|
|
143
|
-
case 3:
|
|
144
|
-
_2 = _a.sent();
|
|
145
|
-
return [3, 4];
|
|
146
|
-
case 4: return [2, false];
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
return AdministrationApi;
|
|
152
|
-
}(baseWithPolingApi_1.default));
|
|
153
|
-
exports.default = AdministrationApi;
|
|
154
|
-
//# sourceMappingURL=administrationApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"administrationApi.js","sourceRoot":"","sources":["../../../src/api/administrationApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAA0B;AAE1B,0EAAiD;AAGjD,kCAA2C;AAE3C;IAA+C,qCAAc;IAG3D,2BACqB,OAAgD,EACzD,eAAgC;QAF5C,YAIE,kBAAM,OAAO,EAAE,eAAe,CAAC,SAChC;QAJoB,aAAO,GAAP,OAAO,CAAyC;QACzD,qBAAe,GAAf,eAAe,CAAiB;QAJ3B,iBAAW,GAAG,OAAO,CAAC;;IAOvC,CAAC;IAEY,4CAAgB,GAA7B;;;gBACE,WAAO,IAAI,CAAC,OAAO,CAAC;wBAClB,MAAM,EAAE,KAAK;wBACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,YAAS;qBACpC,CAAC,EAAC;;;KACJ;IAEY,wCAAY,GAAzB;;;gBACE,WAAO,IAAI,CAAC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
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { v4 } from 'uuid';
|
|
11
|
-
import BaseWithPoling from './baseWithPolingApi';
|
|
12
|
-
import { debouncePromise } from '../utils';
|
|
13
|
-
export default class AdministrationApi extends BaseWithPoling {
|
|
14
|
-
constructor(apiCall, batchProcessApi) {
|
|
15
|
-
super(apiCall, batchProcessApi);
|
|
16
|
-
this.apiCall = apiCall;
|
|
17
|
-
this.batchProcessApi = batchProcessApi;
|
|
18
|
-
this.apiBasePath = 'admin';
|
|
19
|
-
}
|
|
20
|
-
getIndicesStatus() {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
return this.apiCall({
|
|
23
|
-
method: 'GET',
|
|
24
|
-
route: `${this.apiBasePath}/status`,
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
isSystemBusy() {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
return this.apiCall({
|
|
31
|
-
method: 'GET',
|
|
32
|
-
route: `${this.apiBasePath}/busy`,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
addIndex(dbIndex) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const batchId = v4();
|
|
39
|
-
this.apiCall({
|
|
40
|
-
method: 'POST',
|
|
41
|
-
route: `${this.apiBasePath}/index`,
|
|
42
|
-
data: {
|
|
43
|
-
batchId,
|
|
44
|
-
index: dbIndex,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
try {
|
|
48
|
-
yield debouncePromise(() => this.polling(batchId), 3000);
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
catch (_) {
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
dropIndex(dbIndex) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const batchId = v4();
|
|
59
|
-
this.apiCall({
|
|
60
|
-
method: 'DELETE',
|
|
61
|
-
route: `${this.apiBasePath}/index`,
|
|
62
|
-
data: {
|
|
63
|
-
batchId,
|
|
64
|
-
index: dbIndex,
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
try {
|
|
68
|
-
yield debouncePromise(() => this.polling(batchId), 3000);
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
catch (_) {
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=administrationApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"administrationApi.js","sourceRoot":"","sources":["../../../src/api/administrationApi.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAE1B,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,cAAc;IAG3D,YACqB,OAAgD,EACzD,eAAgC;QAE1C,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAHb,YAAO,GAAP,OAAO,CAAyC;QACzD,oBAAe,GAAf,eAAe,CAAiB;QAJ3B,gBAAW,GAAG,OAAO,CAAC;IAOvC,CAAC;IAEY,gBAAgB;;YAC3B,OAAO,IAAI,CAAC,OAAO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,0 @@
|
|
|
1
|
-
import { DbIndicesDto, IndexStatusDto } from '@onereach/types-contacts-api';
|
|
2
|
-
import BaseWithPoling from './baseWithPolingApi';
|
|
3
|
-
import { CalApiParams } from '@or-sdk/base';
|
|
4
|
-
import BatchProcessApi from './batchProcessApi';
|
|
5
|
-
export default class AdministrationApi extends BaseWithPoling {
|
|
6
|
-
protected readonly apiCall: <T>(params: CalApiParams) => Promise<T>;
|
|
7
|
-
protected batchProcessApi: BatchProcessApi;
|
|
8
|
-
private readonly apiBasePath;
|
|
9
|
-
constructor(apiCall: <T>(params: CalApiParams) => Promise<T>, batchProcessApi: BatchProcessApi);
|
|
10
|
-
getIndicesStatus(): Promise<IndexStatusDto[]>;
|
|
11
|
-
isSystemBusy(): Promise<boolean>;
|
|
12
|
-
addIndex(dbIndex: DbIndicesDto): Promise<boolean>;
|
|
13
|
-
dropIndex(dbIndex: DbIndicesDto): Promise<boolean>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=administrationApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"administrationApi.d.ts","sourceRoot":"","sources":["../../../src/api/administrationApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,cAAc;IAIzD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC;IACnE,SAAS,CAAC,eAAe,EAAE,eAAe;IAJ5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAW;gBAGlB,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,EACzD,eAAe,EAAE,eAAe;IAK/B,gBAAgB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAO7C,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAOhC,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAmBjD,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;CAoBhE"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { v4 } from 'uuid';
|
|
3
|
-
import { DbIndicesDto, IndexStatusDto } from '@onereach/types-contacts-api';
|
|
4
|
-
import BaseWithPoling from './baseWithPolingApi';
|
|
5
|
-
import { CalApiParams } from '@or-sdk/base';
|
|
6
|
-
import BatchProcessApi from './batchProcessApi';
|
|
7
|
-
import { debouncePromise } from '../utils';
|
|
8
|
-
|
|
9
|
-
export default class AdministrationApi extends BaseWithPoling {
|
|
10
|
-
private readonly apiBasePath = 'admin';
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
protected readonly apiCall: <T>(params: CalApiParams) => Promise<T>,
|
|
14
|
-
protected batchProcessApi: BatchProcessApi,
|
|
15
|
-
) {
|
|
16
|
-
super(apiCall, batchProcessApi);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public async getIndicesStatus(): Promise<IndexStatusDto[]> {
|
|
20
|
-
return this.apiCall({
|
|
21
|
-
method: 'GET',
|
|
22
|
-
route: `${this.apiBasePath}/status`,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public async isSystemBusy(): Promise<boolean> {
|
|
27
|
-
return this.apiCall({
|
|
28
|
-
method: 'GET',
|
|
29
|
-
route: `${this.apiBasePath}/busy`,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public async addIndex(dbIndex: DbIndicesDto): Promise<boolean> {
|
|
34
|
-
const batchId = v4();
|
|
35
|
-
this.apiCall({
|
|
36
|
-
method: 'POST',
|
|
37
|
-
route: `${this.apiBasePath}/index`,
|
|
38
|
-
data: {
|
|
39
|
-
batchId,
|
|
40
|
-
index: dbIndex,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
try {
|
|
44
|
-
await debouncePromise(() => this.polling(batchId), 3000);
|
|
45
|
-
return true;
|
|
46
|
-
} catch (_) {
|
|
47
|
-
/* empty */
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public async dropIndex(dbIndex: DbIndicesDto): Promise<boolean> {
|
|
53
|
-
const batchId = v4();
|
|
54
|
-
this.apiCall({
|
|
55
|
-
method: 'DELETE',
|
|
56
|
-
route: `${this.apiBasePath}/index`,
|
|
57
|
-
data: {
|
|
58
|
-
batchId,
|
|
59
|
-
index: dbIndex,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
try {
|
|
63
|
-
await debouncePromise(() => this.polling(batchId), 3000);
|
|
64
|
-
return true;
|
|
65
|
-
} catch (_) {
|
|
66
|
-
/* empty */
|
|
67
|
-
}
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|