@or-sdk/contacts 3.0.3-beta.1138.0 → 3.0.3
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/CHANGELOG.md +9 -0
- package/dist/cjs/Contacts.js +1 -6
- package/dist/cjs/Contacts.js.map +1 -1
- package/dist/cjs/api/contactApi.js +6 -87
- package/dist/cjs/api/contactApi.js.map +1 -1
- package/dist/cjs/api/fieldSchemaApi.js +29 -7
- package/dist/cjs/api/fieldSchemaApi.js.map +1 -1
- package/dist/cjs/api/index.js +1 -3
- package/dist/cjs/api/index.js.map +1 -1
- package/dist/esm/Contacts.js +1 -3
- package/dist/esm/Contacts.js.map +1 -1
- package/dist/esm/api/contactApi.js +6 -39
- package/dist/esm/api/contactApi.js.map +1 -1
- package/dist/esm/api/fieldSchemaApi.js +30 -6
- package/dist/esm/api/fieldSchemaApi.js.map +1 -1
- package/dist/esm/api/index.js +0 -1
- package/dist/esm/api/index.js.map +1 -1
- package/dist/types/Contacts.d.ts +0 -2
- package/dist/types/Contacts.d.ts.map +1 -1
- package/dist/types/api/contactApi.d.ts +1 -5
- package/dist/types/api/contactApi.d.ts.map +1 -1
- package/dist/types/api/fieldSchemaApi.d.ts +3 -0
- package/dist/types/api/fieldSchemaApi.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +0 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/Contacts.ts +1 -4
- package/src/api/contactApi.ts +3 -39
- package/src/api/fieldSchemaApi.ts +37 -6
- package/src/api/index.ts +0 -1
- package/dist/cjs/api/batchProcessApi.js +0 -35
- package/dist/cjs/api/batchProcessApi.js.map +0 -1
- package/dist/esm/api/batchProcessApi.js +0 -14
- package/dist/esm/api/batchProcessApi.js.map +0 -1
- package/dist/types/api/batchProcessApi.d.ts +0 -7
- package/dist/types/api/batchProcessApi.d.ts.map +0 -1
- package/src/api/batchProcessApi.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.3](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/contacts@3.0.2...@or-sdk/contacts@3.0.3) (2023-03-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **@or-sdk/contacts:** bump types ([848e883](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/848e88346304527079af9332faea66f7dd870c1b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [3.0.2](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/contacts@3.0.1...@or-sdk/contacts@3.0.2) (2023-03-27)
|
|
7
16
|
|
|
8
17
|
|
package/dist/cjs/Contacts.js
CHANGED
|
@@ -14,16 +14,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
18
|
exports.Contacts = void 0;
|
|
22
19
|
var base_1 = require("@or-sdk/base");
|
|
23
20
|
var constants_1 = require("./constants");
|
|
24
21
|
var api_1 = require("./api");
|
|
25
22
|
var apiError_1 = require("./apiError");
|
|
26
|
-
var batchProcessApi_1 = __importDefault(require("./api/batchProcessApi"));
|
|
27
23
|
var Contacts = (function (_super) {
|
|
28
24
|
__extends(Contacts, _super);
|
|
29
25
|
function Contacts(params) {
|
|
@@ -36,10 +32,9 @@ var Contacts = (function (_super) {
|
|
|
36
32
|
serviceUrl: contactsApiUrl,
|
|
37
33
|
}) || this;
|
|
38
34
|
var apiCall = _this.callApiV2.bind(_this);
|
|
39
|
-
_this.batchProcessApi = new batchProcessApi_1.default(apiCall);
|
|
40
35
|
_this.contactBookApi = new api_1.ContactBookApi(apiCall);
|
|
41
36
|
_this.migrationsApi = new api_1.MigrationsApi(apiCall);
|
|
42
|
-
_this.contactApi = new api_1.ContactApi(apiCall
|
|
37
|
+
_this.contactApi = new api_1.ContactApi(apiCall);
|
|
43
38
|
_this.fieldSchemaApi = new api_1.FieldSchemaApi(apiCall);
|
|
44
39
|
_this.schemaPresetApi = new api_1.SchemaPresetApi(apiCall);
|
|
45
40
|
_this.filterApi = new api_1.FilterApi(apiCall);
|
package/dist/cjs/Contacts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qCAAgD;AAEhD,yCAAmD;AACnD,6BASe;AACf,uCAAsC;AAStC;IAA8B,4BAAI;IAgBhC,kBAAY,MAAsB;QAAlC,iBAkBC;QAjBS,IAAA,KAAK,GAAmC,MAAM,MAAzC,EAAE,YAAY,GAAqB,MAAM,aAA3B,EAAE,cAAc,GAAK,MAAM,eAAX,CAAY;gBACvD,kBAAM;YACJ,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,UAAU,EAAE,gCAAoB;YAChC,UAAU,EAAE,cAAc;SAC3B,CAAC;QAEF,IAAM,OAAO,GAAG,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;QAC1C,KAAI,CAAC,cAAc,GAAG,IAAI,oBAAc,CAAC,OAAO,CAAC,CAAC;QAClD,KAAI,CAAC,aAAa,GAAG,IAAI,mBAAa,CAAC,OAAO,CAAC,CAAC;QAChD,KAAI,CAAC,UAAU,GAAG,IAAI,gBAAU,CAAC,OAAO,CAAC,CAAC;QAC1C,KAAI,CAAC,cAAc,GAAG,IAAI,oBAAc,CAAC,OAAO,CAAC,CAAC;QAClD,KAAI,CAAC,eAAe,GAAG,IAAI,qBAAe,CAAC,OAAO,CAAC,CAAC;QACpD,KAAI,CAAC,SAAS,GAAG,IAAI,eAAS,CAAC,OAAO,CAAC,CAAC;QACxC,KAAI,CAAC,8BAA8B,GAAG,IAAI,oCAA8B,CAAC,OAAO,CAAC,CAAC;QAClF,KAAI,CAAC,aAAa,GAAG,IAAI,mBAAa,CAAC,OAAO,CAAC,CAAC;;IAClD,CAAC;IAED,6BAAU,GAAV,UAAW,CAAa;;QACtB,IAAI,CAAC,CAAC,YAAY,KAAI,MAAA,CAAC,CAAC,QAAQ,0CAAE,IAAI,CAAA,EAAE;YAChC,IAAA,KAA0B,CAAC,CAAC,QAAQ,CAAC,IAAW,EAA9C,UAAU,gBAAA,EAAE,OAAO,aAA2B,CAAC;YACvD,OAAO,IAAI,mBAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;SACnD;QACD,OAAO,iBAAM,UAAU,YAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IACH,eAAC;AAAD,CAAC,AA3CD,CAA8B,WAAI,GA2CjC;AA3CY,4BAAQ"}
|
|
@@ -25,52 +25,13 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
};
|
|
26
26
|
return __assign.apply(this, arguments);
|
|
27
27
|
};
|
|
28
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
-
function step(op) {
|
|
42
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
44
|
-
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;
|
|
45
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
-
switch (op[0]) {
|
|
47
|
-
case 0: case 1: t = op; break;
|
|
48
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
-
default:
|
|
52
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
-
if (t[2]) _.ops.pop();
|
|
57
|
-
_.trys.pop(); continue;
|
|
58
|
-
}
|
|
59
|
-
op = body.call(thisArg, _);
|
|
60
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
29
|
var baseApi_1 = require("./baseApi");
|
|
66
|
-
var types_contacts_api_1 = require("@onereach/types-contacts-api");
|
|
67
30
|
var utils_1 = require("../utils");
|
|
68
31
|
var ContactApi = (function (_super) {
|
|
69
32
|
__extends(ContactApi, _super);
|
|
70
|
-
function ContactApi(
|
|
71
|
-
var _this = _super.
|
|
72
|
-
_this.apiCall = apiCall;
|
|
73
|
-
_this.batchProcessApi = batchProcessApi;
|
|
33
|
+
function ContactApi() {
|
|
34
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
74
35
|
_this.apiBasePath = 'contact';
|
|
75
36
|
return _this;
|
|
76
37
|
}
|
|
@@ -117,52 +78,10 @@ var ContactApi = (function (_super) {
|
|
|
117
78
|
});
|
|
118
79
|
};
|
|
119
80
|
ContactApi.prototype.bulkCreateContacts = function (data) {
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
switch (_a.label) {
|
|
125
|
-
case 0: return [4, this.apiCall({
|
|
126
|
-
method: 'POST',
|
|
127
|
-
route: "".concat(this.apiBasePath, "/bulk"),
|
|
128
|
-
data: data,
|
|
129
|
-
})];
|
|
130
|
-
case 1:
|
|
131
|
-
batchProcess = _a.sent();
|
|
132
|
-
polling = function (ms) {
|
|
133
|
-
return new Promise(function (res, rej) {
|
|
134
|
-
var intervalId = setInterval(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
135
|
-
var batchProcessState, e_1;
|
|
136
|
-
return __generator(this, function (_a) {
|
|
137
|
-
switch (_a.label) {
|
|
138
|
-
case 0:
|
|
139
|
-
_a.trys.push([0, 2, , 3]);
|
|
140
|
-
return [4, this.batchProcessApi.getBatchProcess(batchProcess.id)];
|
|
141
|
-
case 1:
|
|
142
|
-
batchProcessState = _a.sent();
|
|
143
|
-
if (batchProcessState.status !== types_contacts_api_1.BatchProcessStatus.pending) {
|
|
144
|
-
res(batchProcessState);
|
|
145
|
-
}
|
|
146
|
-
return [3, 3];
|
|
147
|
-
case 2:
|
|
148
|
-
e_1 = _a.sent();
|
|
149
|
-
clearInterval(intervalId);
|
|
150
|
-
rej(e_1);
|
|
151
|
-
return [3, 3];
|
|
152
|
-
case 3: return [2];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}); }, ms);
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
return [4, polling(1000)];
|
|
159
|
-
case 2:
|
|
160
|
-
batchProcessResult = _a.sent();
|
|
161
|
-
contactIds = batchProcessResult.results.flat();
|
|
162
|
-
return [4, this.listContact(__assign({ contactIds: contactIds }, (data.contact_book && { contact_book: data.contact_book })))];
|
|
163
|
-
case 3: return [2, (_a.sent()).items];
|
|
164
|
-
}
|
|
165
|
-
});
|
|
81
|
+
return this.apiCall({
|
|
82
|
+
method: 'POST',
|
|
83
|
+
route: "".concat(this.apiBasePath, "/bulk"),
|
|
84
|
+
data: data,
|
|
166
85
|
});
|
|
167
86
|
};
|
|
168
87
|
ContactApi.prototype.mergeContacts = function (id, data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAgBpC,kCAA2C;AAG3C;IAAwC,8BAAO;IAA/C;QAAA,qEA2JC;QA1JkB,iBAAW,GAAG,SAAS,CAAC;;IA0J3C,CAAC;IAnJC,+BAAU,GAAV,UAAW,EAAU,EAAE,MAAwB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,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__extends(FieldSchemaApi, _super);
|
|
33
33
|
function FieldSchemaApi() {
|
|
34
|
-
|
|
34
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
35
|
+
_this.apiBasePath = 'field-schema';
|
|
36
|
+
return _this;
|
|
35
37
|
}
|
|
36
38
|
FieldSchemaApi.prototype.getSchema = function (id) {
|
|
37
39
|
return this.apiCall({
|
|
38
40
|
method: 'GET',
|
|
39
|
-
route: "
|
|
41
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
40
42
|
});
|
|
41
43
|
};
|
|
42
44
|
FieldSchemaApi.prototype.listSchemas = function (params) {
|
|
43
45
|
return this.apiCall({
|
|
44
46
|
method: 'GET',
|
|
45
|
-
route:
|
|
47
|
+
route: "".concat(this.apiBasePath),
|
|
46
48
|
params: __assign({}, (0, utils_1.adaptListParams)(params)),
|
|
47
49
|
});
|
|
48
50
|
};
|
|
49
51
|
FieldSchemaApi.prototype.isMachineNameExist = function (machineName) {
|
|
50
52
|
return this.apiCall({
|
|
51
53
|
method: 'GET',
|
|
52
|
-
route:
|
|
54
|
+
route: "".concat(this.apiBasePath, "/machine-name-exist"),
|
|
53
55
|
params: {
|
|
54
56
|
machine_name: machineName,
|
|
55
57
|
},
|
|
56
58
|
});
|
|
57
59
|
};
|
|
60
|
+
FieldSchemaApi.prototype.lockFields = function (fields) {
|
|
61
|
+
return this.apiCall({
|
|
62
|
+
method: 'PATCH',
|
|
63
|
+
route: "".concat(this.apiBasePath, "/readonly"),
|
|
64
|
+
data: {
|
|
65
|
+
readonly: true,
|
|
66
|
+
fields: fields,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
FieldSchemaApi.prototype.unlockFields = function (fields) {
|
|
71
|
+
return this.apiCall({
|
|
72
|
+
method: 'PATCH',
|
|
73
|
+
route: "".concat(this.apiBasePath, "/readonly"),
|
|
74
|
+
data: {
|
|
75
|
+
readonly: false,
|
|
76
|
+
fields: fields,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
};
|
|
58
80
|
FieldSchemaApi.prototype.updateSchema = function (id, data) {
|
|
59
81
|
return this.apiCall({
|
|
60
82
|
method: 'PATCH',
|
|
61
|
-
route: "
|
|
83
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
62
84
|
data: data,
|
|
63
85
|
});
|
|
64
86
|
};
|
|
@@ -66,14 +88,14 @@ var FieldSchemaApi = (function (_super) {
|
|
|
66
88
|
if (data === void 0) { data = {}; }
|
|
67
89
|
return this.apiCall({
|
|
68
90
|
method: 'DELETE',
|
|
69
|
-
route: "
|
|
91
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
70
92
|
data: data,
|
|
71
93
|
});
|
|
72
94
|
};
|
|
73
95
|
FieldSchemaApi.prototype.createSchema = function (data) {
|
|
74
96
|
return this.apiCall({
|
|
75
97
|
method: 'POST',
|
|
76
|
-
route:
|
|
98
|
+
route: "".concat(this.apiBasePath),
|
|
77
99
|
data: data,
|
|
78
100
|
});
|
|
79
101
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldSchemaApi.js","sourceRoot":"","sources":["../../../src/api/fieldSchemaApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAUpC,kCAA2C;AAE3C;IAA4C,kCAAO;IAAnD;;
|
|
1
|
+
{"version":3,"file":"fieldSchemaApi.js","sourceRoot":"","sources":["../../../src/api/fieldSchemaApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAUpC,kCAA2C;AAE3C;IAA4C,kCAAO;IAAnD;QAAA,qEA0GC;QAzGkB,iBAAW,GAAG,cAAc,CAAC;;IAyGhD,CAAC;IApGC,kCAAS,GAAT,UAAU,EAAU;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,c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AA,EAAA,SAAqC;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,CAAE;YAClC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAMD,qCAAY,GAAZ,UAAa,IAA0B;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;YAC5B,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IACH,qBAAC;AAAD,CAAC,AA1GD,CAA4C,iBAAO,GA0GlD"}
|
package/dist/cjs/api/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.
|
|
6
|
+
exports.FieldValueApi = exports.SharedBookContactPermissionApi = exports.FilterApi = exports.SchemaPresetApi = exports.FieldSchemaApi = exports.MigrationsApi = exports.ContactBookApi = exports.ContactApi = void 0;
|
|
7
7
|
var contactApi_1 = require("./contactApi");
|
|
8
8
|
Object.defineProperty(exports, "ContactApi", { enumerable: true, get: function () { return __importDefault(contactApi_1).default; } });
|
|
9
9
|
var contactBookApi_1 = require("./contactBookApi");
|
|
@@ -20,6 +20,4 @@ var sharedBookContactPermissionApi_1 = require("./sharedBookContactPermissionApi
|
|
|
20
20
|
Object.defineProperty(exports, "SharedBookContactPermissionApi", { enumerable: true, get: function () { return __importDefault(sharedBookContactPermissionApi_1).default; } });
|
|
21
21
|
var fieldValueApi_1 = require("./fieldValueApi");
|
|
22
22
|
Object.defineProperty(exports, "FieldValueApi", { enumerable: true, get: function () { return __importDefault(fieldValueApi_1).default; } });
|
|
23
|
-
var batchProcessApi_1 = require("./batchProcessApi");
|
|
24
|
-
Object.defineProperty(exports, "BatchProcessApi", { enumerable: true, get: function () { return __importDefault(batchProcessApi_1).default; } });
|
|
25
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AAA5C,yHAAA,OAAO,OAAc;AAC9B,mDAA6D;AAApD,iIAAA,OAAO,OAAkB;AAClC,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB;AACjC,mDAA6D;AAApD,iIAAA,OAAO,OAAkB;AAClC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,yCAAmD;AAA1C,uHAAA,OAAO,OAAa;AAC7B,mFAA6F;AAApF,iKAAA,OAAO,OAAkC;AAClD,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AAA5C,yHAAA,OAAO,OAAc;AAC9B,mDAA6D;AAApD,iIAAA,OAAO,OAAkB;AAClC,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB;AACjC,mDAA6D;AAApD,iIAAA,OAAO,OAAkB;AAClC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,yCAAmD;AAA1C,uHAAA,OAAO,OAAa;AAC7B,mFAA6F;AAApF,iKAAA,OAAO,OAAkC;AAClD,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB"}
|
package/dist/esm/Contacts.js
CHANGED
|
@@ -2,7 +2,6 @@ import { Base } from '@or-sdk/base';
|
|
|
2
2
|
import { CONTACTS_SERVICE_KEY } from './constants';
|
|
3
3
|
import { ContactBookApi, MigrationsApi, ContactApi, FieldSchemaApi, SchemaPresetApi, FilterApi, SharedBookContactPermissionApi, FieldValueApi, } from './api';
|
|
4
4
|
import { ApiError } from './apiError';
|
|
5
|
-
import BatchProcessApi from './api/batchProcessApi';
|
|
6
5
|
export class Contacts extends Base {
|
|
7
6
|
constructor(params) {
|
|
8
7
|
const { token, discoveryUrl, contactsApiUrl } = params;
|
|
@@ -13,10 +12,9 @@ export class Contacts extends Base {
|
|
|
13
12
|
serviceUrl: contactsApiUrl,
|
|
14
13
|
});
|
|
15
14
|
const apiCall = this.callApiV2.bind(this);
|
|
16
|
-
this.batchProcessApi = new BatchProcessApi(apiCall);
|
|
17
15
|
this.contactBookApi = new ContactBookApi(apiCall);
|
|
18
16
|
this.migrationsApi = new MigrationsApi(apiCall);
|
|
19
|
-
this.contactApi = new ContactApi(apiCall
|
|
17
|
+
this.contactApi = new ContactApi(apiCall);
|
|
20
18
|
this.fieldSchemaApi = new FieldSchemaApi(apiCall);
|
|
21
19
|
this.schemaPresetApi = new SchemaPresetApi(apiCall);
|
|
22
20
|
this.filterApi = new FilterApi(apiCall);
|
package/dist/esm/Contacts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,EACT,8BAA8B,EAC9B,aAAa,GACd,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,EACT,8BAA8B,EAC9B,aA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ACD,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
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
1
|
import { BaseApi } from './baseApi';
|
|
11
|
-
import { BatchProcessStatus, } from '@onereach/types-contacts-api';
|
|
12
2
|
import { adaptListParams } from '../utils';
|
|
13
3
|
export default class ContactApi extends BaseApi {
|
|
14
|
-
constructor(
|
|
15
|
-
super(
|
|
16
|
-
this.apiCall = apiCall;
|
|
17
|
-
this.batchProcessApi = batchProcessApi;
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
18
6
|
this.apiBasePath = 'contact';
|
|
19
7
|
}
|
|
20
8
|
getContact(id, params) {
|
|
@@ -60,31 +48,10 @@ export default class ContactApi extends BaseApi {
|
|
|
60
48
|
});
|
|
61
49
|
}
|
|
62
50
|
bulkCreateContacts(data) {
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
data,
|
|
68
|
-
});
|
|
69
|
-
const polling = (ms) => {
|
|
70
|
-
return new Promise((res, rej) => {
|
|
71
|
-
const intervalId = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
try {
|
|
73
|
-
const batchProcessState = yield this.batchProcessApi.getBatchProcess(batchProcess.id);
|
|
74
|
-
if (batchProcessState.status !== BatchProcessStatus.pending) {
|
|
75
|
-
res(batchProcessState);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
clearInterval(intervalId);
|
|
80
|
-
rej(e);
|
|
81
|
-
}
|
|
82
|
-
}), ms);
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const batchProcessResult = yield polling(1000);
|
|
86
|
-
const contactIds = batchProcessResult.results.flat();
|
|
87
|
-
return (yield this.listContact(Object.assign({ contactIds }, (data.contact_book && { contact_book: data.contact_book })))).items;
|
|
51
|
+
return this.apiCall({
|
|
52
|
+
method: 'POST',
|
|
53
|
+
route: `${this.apiBasePath}/bulk`,
|
|
54
|
+
data,
|
|
88
55
|
});
|
|
89
56
|
}
|
|
90
57
|
mergeContacts(id, data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAA/C;;QACmB,gBAAW,GAAG,SAAS,CAAC;IA0J3C,CAAC;IAnJC,UAAU,CAAC,EAAU,EAAE,MAAwB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;YAClC,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAMD,WAAW,CAAC,MAA2B;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,OAAO;YACjC,IA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AO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,OAAO;YACvC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAMD,iBAAiB,CAAC,IAA+B;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,OAAO;YACjC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAOD,aAAa,CAAC,EAAU,EAAE,IAA4B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,OAAO;YACvC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAMD,mBAAmB,CAAC,IAAiC;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,OAAO;YACjC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,46 +1,70 @@
|
|
|
1
1
|
import { BaseApi } from './baseApi';
|
|
2
2
|
import { adaptListParams } from '../utils';
|
|
3
3
|
export default class FieldSchemaApi extends BaseApi {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.apiBasePath = 'field-schema';
|
|
7
|
+
}
|
|
4
8
|
getSchema(id) {
|
|
5
9
|
return this.apiCall({
|
|
6
10
|
method: 'GET',
|
|
7
|
-
route:
|
|
11
|
+
route: `${this.apiBasePath}/${id}`,
|
|
8
12
|
});
|
|
9
13
|
}
|
|
10
14
|
listSchemas(params) {
|
|
11
15
|
return this.apiCall({
|
|
12
16
|
method: 'GET',
|
|
13
|
-
route:
|
|
17
|
+
route: `${this.apiBasePath}`,
|
|
14
18
|
params: Object.assign({}, adaptListParams(params)),
|
|
15
19
|
});
|
|
16
20
|
}
|
|
17
21
|
isMachineNameExist(machineName) {
|
|
18
22
|
return this.apiCall({
|
|
19
23
|
method: 'GET',
|
|
20
|
-
route:
|
|
24
|
+
route: `${this.apiBasePath}/machine-name-exist`,
|
|
21
25
|
params: {
|
|
22
26
|
machine_name: machineName,
|
|
23
27
|
},
|
|
24
28
|
});
|
|
25
29
|
}
|
|
30
|
+
lockFields(fields) {
|
|
31
|
+
return this.apiCall({
|
|
32
|
+
method: 'PATCH',
|
|
33
|
+
route: `${this.apiBasePath}/readonly`,
|
|
34
|
+
data: {
|
|
35
|
+
readonly: true,
|
|
36
|
+
fields,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
unlockFields(fields) {
|
|
41
|
+
return this.apiCall({
|
|
42
|
+
method: 'PATCH',
|
|
43
|
+
route: `${this.apiBasePath}/readonly`,
|
|
44
|
+
data: {
|
|
45
|
+
readonly: false,
|
|
46
|
+
fields,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
26
50
|
updateSchema(id, data) {
|
|
27
51
|
return this.apiCall({
|
|
28
52
|
method: 'PATCH',
|
|
29
|
-
route:
|
|
53
|
+
route: `${this.apiBasePath}/${id}`,
|
|
30
54
|
data,
|
|
31
55
|
});
|
|
32
56
|
}
|
|
33
57
|
deleteSchema(id, data = {}) {
|
|
34
58
|
return this.apiCall({
|
|
35
59
|
method: 'DELETE',
|
|
36
|
-
route:
|
|
60
|
+
route: `${this.apiBasePath}/${id}`,
|
|
37
61
|
data,
|
|
38
62
|
});
|
|
39
63
|
}
|
|
40
64
|
createSchema(data) {
|
|
41
65
|
return this.apiCall({
|
|
42
66
|
method: 'POST',
|
|
43
|
-
route:
|
|
67
|
+
route: `${this.apiBasePath}`,
|
|
44
68
|
data,
|
|
45
69
|
});
|
|
46
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldSchemaApi.js","sourceRoot":"","sources":["../../../src/api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QAAQ,EAAE,IAAI;gBACd,MAAM;aACP;SACF,CAAC,CAAC;IACL,CAAC;IAMD,YAAY,CAAC,MAAgB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,WAAW;YACrC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;gBACf,MAAM;aACP;SACF,CAAC,CAAC;IACL,CAAC;IAOD,YAAY,CAAC,EAAU,EAAE,IAA0B;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;YAClC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAOD,YAAY,CAAC,EAAU,EAAE,OAAmC,EAAE;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;YAClC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAMD,YAAY,CAAC,IAA0B;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;YAC5B,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/esm/api/index.js
CHANGED
|
@@ -6,5 +6,4 @@ export { default as SchemaPresetApi } from './schemaPresetApi';
|
|
|
6
6
|
export { default as FilterApi } from './filterApi';
|
|
7
7
|
export { default as SharedBookContactPermissionApi } from './sharedBookContactPermissionApi';
|
|
8
8
|
export { default as FieldValueApi } from './fieldValueApi';
|
|
9
|
-
export { default as BatchProcessApi } from './batchProcessApi';
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/types/Contacts.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { AxiosError, Base } from '@or-sdk/base';
|
|
2
2
|
import { ContactsConfig } from './types';
|
|
3
3
|
import { ContactBookApi, MigrationsApi, ContactApi, FieldSchemaApi, SchemaPresetApi, FilterApi, SharedBookContactPermissionApi, FieldValueApi } from './api';
|
|
4
|
-
import BatchProcessApi from './api/batchProcessApi';
|
|
5
4
|
export declare class Contacts extends Base {
|
|
6
|
-
readonly batchProcessApi: BatchProcessApi;
|
|
7
5
|
readonly contactBookApi: ContactBookApi;
|
|
8
6
|
readonly migrationsApi: MigrationsApi;
|
|
9
7
|
readonly contactApi: ContactApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.d.ts","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,EACT,8BAA8B,EAC9B,aAAa,EACd,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Contacts.d.ts","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,EACT,8BAA8B,EAC9B,aAAa,EACd,MAAM,OAAO,CAAC;AAUf,qBAAa,QAAS,SAAQ,IAAI;IAEhC,SAAgB,cAAc,EAAE,cAAc,CAAC;IAC/C,SAAgB,aAAa,EAAE,aAAa,CAAC;IAC7C,SAAgB,UAAU,EAAE,UAAU,CAAC;IACvC,SAAgB,cAAc,EAAE,cAAc,CAAC;IAC/C,SAAgB,eAAe,EAAE,eAAe,CAAC;IACjD,SAAgB,SAAS,EAAE,SAAS,CAAC;IACrC,SAAgB,8BAA8B,EAAE,8BAA8B,CAAC;IAC/E,SAAgB,aAAa,EAAE,aAAa,CAAC;gBAOjC,MAAM,EAAE,cAAc;IAoBlC,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,KAAK;CAOjC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { BaseApi } from './baseApi';
|
|
2
2
|
import { ContactResponseDto, CreateContactDto, CreateMultipleContactsDto, UpdateContactDto, ContactParamsDto, MergeContactParamsDto, DeleteContactParamsDto, DeleteContactMultiParamsDto, LinkContactParamsDto, LinkContactMultiParamsDto, UnlinkContactParamsDto, UnlinkContactMultiParamsDto } from '@onereach/types-contacts-api';
|
|
3
3
|
import { ContactSearchParams } from '../types';
|
|
4
|
-
import {
|
|
5
|
-
import BatchProcessApi from './batchProcessApi';
|
|
4
|
+
import { List } from '@or-sdk/base';
|
|
6
5
|
export default class ContactApi extends BaseApi {
|
|
7
|
-
protected readonly apiCall: <T>(params: CalApiParams) => Promise<T>;
|
|
8
|
-
private batchProcessApi;
|
|
9
|
-
constructor(apiCall: <T>(params: CalApiParams) => Promise<T>, batchProcessApi: BatchProcessApi);
|
|
10
6
|
private readonly apiBasePath;
|
|
11
7
|
getContact(id: string, params: ContactParamsDto): Promise<ContactResponseDto>;
|
|
12
8
|
listContact(params: ContactSearchParams): Promise<List<ContactResponseDto>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactApi.d.ts","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"contactApi.d.ts","sourceRoot":"","sources":["../../../src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BAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlE,iBAAiB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAajE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYtE,mBAAmB,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;CAOtE"}
|
|
@@ -3,9 +3,12 @@ import { FieldSchemaResponseDto, UpdateFieldSchemaDto, CreateFieldSchemaDto, Fie
|
|
|
3
3
|
import { List } from '@or-sdk/base';
|
|
4
4
|
import { AdaptedListParams } from '../types';
|
|
5
5
|
export default class FieldSchemaApi extends BaseApi {
|
|
6
|
+
private readonly apiBasePath;
|
|
6
7
|
getSchema(id: string): Promise<FieldSchemaResponseDto>;
|
|
7
8
|
listSchemas(params: AdaptedListParams<FieldSchemaListParamsDto>): Promise<List<FieldSchemaResponseDto>>;
|
|
8
9
|
isMachineNameExist(machineName: string): Promise<boolean>;
|
|
10
|
+
lockFields(fields: string[]): Promise<void>;
|
|
11
|
+
unlockFields(fields: string[]): Promise<void>;
|
|
9
12
|
updateSchema(id: string, data: UpdateFieldSchemaDto): Promise<FieldSchemaResponseDto>;
|
|
10
13
|
deleteSchema(id: string, data?: FieldSchemaDeleteParamsDto): Promise<void>;
|
|
11
14
|
createSchema(data: CreateFieldSchemaDto): Promise<FieldSchemaResponseDto>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldSchemaApi.d.ts","sourceRoot":"","sources":["../../../src/api/fieldSchemaApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAA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@ -6,5 +6,4 @@ export { default as SchemaPresetApi } from './schemaPresetApi';
|
|
|
6
6
|
export { default as FilterApi } from './filterApi';
|
|
7
7
|
export { default as SharedBookContactPermissionApi } from './sharedBookContactPermissionApi';
|
|
8
8
|
export { default as FieldValueApi } from './fieldValueApi';
|
|
9
|
-
export { default as BatchProcessApi } from './batchProcessApi';
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.0.3
|
|
2
|
+
"version": "3.0.3",
|
|
3
3
|
"name": "@or-sdk/contacts",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@onereach/types-contacts-api": "2.2.
|
|
27
|
+
"@onereach/types-contacts-api": "2.2.8-beta.1654.0",
|
|
28
28
|
"@or-sdk/base": "^0.28.1"
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
|
+
"gitHead": "630a5a0537532d57f25e7db98584bc64fcf85062"
|
|
30
31
|
}
|
package/src/Contacts.ts
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
FieldValueApi,
|
|
13
13
|
} from './api';
|
|
14
14
|
import { ApiError } from './apiError';
|
|
15
|
-
import BatchProcessApi from './api/batchProcessApi';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* OneReach Contacts service client
|
|
@@ -23,7 +22,6 @@ import BatchProcessApi from './api/batchProcessApi';
|
|
|
23
22
|
*/
|
|
24
23
|
export class Contacts extends Base {
|
|
25
24
|
|
|
26
|
-
public readonly batchProcessApi: BatchProcessApi;
|
|
27
25
|
public readonly contactBookApi: ContactBookApi;
|
|
28
26
|
public readonly migrationsApi: MigrationsApi;
|
|
29
27
|
public readonly contactApi: ContactApi;
|
|
@@ -48,10 +46,9 @@ export class Contacts extends Base {
|
|
|
48
46
|
});
|
|
49
47
|
|
|
50
48
|
const apiCall = this.callApiV2.bind(this);
|
|
51
|
-
this.batchProcessApi = new BatchProcessApi(apiCall);
|
|
52
49
|
this.contactBookApi = new ContactBookApi(apiCall);
|
|
53
50
|
this.migrationsApi = new MigrationsApi(apiCall);
|
|
54
|
-
this.contactApi = new ContactApi(apiCall
|
|
51
|
+
this.contactApi = new ContactApi(apiCall);
|
|
55
52
|
this.fieldSchemaApi = new FieldSchemaApi(apiCall);
|
|
56
53
|
this.schemaPresetApi = new SchemaPresetApi(apiCall);
|
|
57
54
|
this.filterApi = new FilterApi(apiCall);
|
package/src/api/contactApi.ts
CHANGED
|
@@ -12,21 +12,12 @@ import {
|
|
|
12
12
|
LinkContactMultiParamsDto,
|
|
13
13
|
UnlinkContactParamsDto,
|
|
14
14
|
UnlinkContactMultiParamsDto,
|
|
15
|
-
BatchProcessResponseDto,
|
|
16
|
-
BatchProcessStatus,
|
|
17
15
|
} from '@onereach/types-contacts-api';
|
|
18
16
|
import { ContactSearchParams } from '../types';
|
|
19
17
|
import { adaptListParams } from '../utils';
|
|
20
|
-
import {
|
|
21
|
-
import BatchProcessApi from './batchProcessApi';
|
|
18
|
+
import { List } from '@or-sdk/base';
|
|
22
19
|
|
|
23
20
|
export default class ContactApi extends BaseApi {
|
|
24
|
-
constructor(
|
|
25
|
-
protected readonly apiCall: <T>(params: CalApiParams) => Promise<T>,
|
|
26
|
-
private batchProcessApi: BatchProcessApi
|
|
27
|
-
) {
|
|
28
|
-
super(apiCall);
|
|
29
|
-
}
|
|
30
21
|
private readonly apiBasePath = 'contact';
|
|
31
22
|
|
|
32
23
|
/**
|
|
@@ -111,39 +102,12 @@ export default class ContactApi extends BaseApi {
|
|
|
111
102
|
* @description Create Contacts
|
|
112
103
|
* @param data
|
|
113
104
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
bulkCreateContacts(data: CreateMultipleContactsDto): Promise<ContactResponseDto[]> {
|
|
106
|
+
return this.apiCall({
|
|
116
107
|
method: 'POST',
|
|
117
108
|
route: `${this.apiBasePath}/bulk`,
|
|
118
109
|
data,
|
|
119
110
|
});
|
|
120
|
-
|
|
121
|
-
const polling = (ms: number): Promise<BatchProcessResponseDto> => {
|
|
122
|
-
return new Promise((res, rej) => {
|
|
123
|
-
const intervalId = setInterval(async () => {
|
|
124
|
-
try {
|
|
125
|
-
const batchProcessState = await this.batchProcessApi.getBatchProcess(batchProcess.id);
|
|
126
|
-
if (batchProcessState.status !== BatchProcessStatus.pending) {
|
|
127
|
-
res(batchProcessState);
|
|
128
|
-
}
|
|
129
|
-
} catch (e) {
|
|
130
|
-
clearInterval(intervalId);
|
|
131
|
-
rej(e);
|
|
132
|
-
}
|
|
133
|
-
}, ms);
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const batchProcessResult = await polling(1000);
|
|
139
|
-
const contactIds = batchProcessResult.results.flat();
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
await this.listContact({
|
|
143
|
-
contactIds,
|
|
144
|
-
...(data.contact_book && { contact_book: data.contact_book }),
|
|
145
|
-
})
|
|
146
|
-
).items;
|
|
147
111
|
}
|
|
148
112
|
|
|
149
113
|
/**
|
|
@@ -11,6 +11,7 @@ import { AdaptedListParams } from '../types';
|
|
|
11
11
|
import { adaptListParams } from '../utils';
|
|
12
12
|
|
|
13
13
|
export default class FieldSchemaApi extends BaseApi {
|
|
14
|
+
private readonly apiBasePath = 'field-schema';
|
|
14
15
|
/**
|
|
15
16
|
* @description Get specific field schema
|
|
16
17
|
* @param id
|
|
@@ -18,7 +19,7 @@ export default class FieldSchemaApi extends BaseApi {
|
|
|
18
19
|
getSchema(id: string): Promise<FieldSchemaResponseDto> {
|
|
19
20
|
return this.apiCall({
|
|
20
21
|
method: 'GET',
|
|
21
|
-
route:
|
|
22
|
+
route: `${this.apiBasePath}/${id}`,
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -28,7 +29,7 @@ export default class FieldSchemaApi extends BaseApi {
|
|
|
28
29
|
listSchemas(params: AdaptedListParams<FieldSchemaListParamsDto>): Promise<List<FieldSchemaResponseDto>> {
|
|
29
30
|
return this.apiCall({
|
|
30
31
|
method: 'GET',
|
|
31
|
-
route:
|
|
32
|
+
route: `${this.apiBasePath}`,
|
|
32
33
|
params: {
|
|
33
34
|
...adaptListParams(params),
|
|
34
35
|
},
|
|
@@ -41,13 +42,43 @@ export default class FieldSchemaApi extends BaseApi {
|
|
|
41
42
|
isMachineNameExist(machineName: string): Promise<boolean> {
|
|
42
43
|
return this.apiCall({
|
|
43
44
|
method: 'GET',
|
|
44
|
-
route:
|
|
45
|
+
route: `${this.apiBasePath}/machine-name-exist`,
|
|
45
46
|
params: {
|
|
46
47
|
machine_name: machineName,
|
|
47
48
|
},
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Lock "fieldSchema" from being updated
|
|
54
|
+
* @param fields
|
|
55
|
+
*/
|
|
56
|
+
lockFields(fields: string[]): Promise<void> {
|
|
57
|
+
return this.apiCall({
|
|
58
|
+
method: 'PATCH',
|
|
59
|
+
route: `${this.apiBasePath}/readonly`,
|
|
60
|
+
data: {
|
|
61
|
+
readonly: true,
|
|
62
|
+
fields,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Unlock "fieldSchema" to be able to update
|
|
69
|
+
* @param fields
|
|
70
|
+
*/
|
|
71
|
+
unlockFields(fields: string[]): Promise<void> {
|
|
72
|
+
return this.apiCall({
|
|
73
|
+
method: 'PATCH',
|
|
74
|
+
route: `${this.apiBasePath}/readonly`,
|
|
75
|
+
data: {
|
|
76
|
+
readonly: false,
|
|
77
|
+
fields,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
51
82
|
/**
|
|
52
83
|
* @description Update field schema
|
|
53
84
|
* @param data
|
|
@@ -56,7 +87,7 @@ export default class FieldSchemaApi extends BaseApi {
|
|
|
56
87
|
updateSchema(id: string, data: UpdateFieldSchemaDto): Promise<FieldSchemaResponseDto> {
|
|
57
88
|
return this.apiCall({
|
|
58
89
|
method: 'PATCH',
|
|
59
|
-
route:
|
|
90
|
+
route: `${this.apiBasePath}/${id}`,
|
|
60
91
|
data,
|
|
61
92
|
});
|
|
62
93
|
}
|
|
@@ -69,7 +100,7 @@ export default class FieldSchemaApi extends BaseApi {
|
|
|
69
100
|
deleteSchema(id: string, data: FieldSchemaDeleteParamsDto = {}): Promise<void> {
|
|
70
101
|
return this.apiCall({
|
|
71
102
|
method: 'DELETE',
|
|
72
|
-
route:
|
|
103
|
+
route: `${this.apiBasePath}/${id}`,
|
|
73
104
|
data,
|
|
74
105
|
});
|
|
75
106
|
}
|
|
@@ -81,7 +112,7 @@ export default class FieldSchemaApi extends BaseApi {
|
|
|
81
112
|
createSchema(data: CreateFieldSchemaDto): Promise<FieldSchemaResponseDto> {
|
|
82
113
|
return this.apiCall({
|
|
83
114
|
method: 'POST',
|
|
84
|
-
route:
|
|
115
|
+
route: `${this.apiBasePath}`,
|
|
85
116
|
data,
|
|
86
117
|
});
|
|
87
118
|
}
|
package/src/api/index.ts
CHANGED
|
@@ -6,4 +6,3 @@ export { default as SchemaPresetApi } from './schemaPresetApi';
|
|
|
6
6
|
export { default as FilterApi } from './filterApi';
|
|
7
7
|
export { default as SharedBookContactPermissionApi } from './sharedBookContactPermissionApi';
|
|
8
8
|
export { default as FieldValueApi } from './fieldValueApi';
|
|
9
|
-
export { default as BatchProcessApi } from './batchProcessApi';
|
|
@@ -1,35 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var baseApi_1 = require("./baseApi");
|
|
19
|
-
var BatchProcessApi = (function (_super) {
|
|
20
|
-
__extends(BatchProcessApi, _super);
|
|
21
|
-
function BatchProcessApi() {
|
|
22
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
-
_this.apiBasePath = 'batch-process';
|
|
24
|
-
return _this;
|
|
25
|
-
}
|
|
26
|
-
BatchProcessApi.prototype.getBatchProcess = function (id) {
|
|
27
|
-
return this.apiCall({
|
|
28
|
-
method: 'GET',
|
|
29
|
-
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
return BatchProcessApi;
|
|
33
|
-
}(baseApi_1.BaseApi));
|
|
34
|
-
exports.default = BatchProcessApi;
|
|
35
|
-
//# sourceMappingURL=batchProcessApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchProcessApi.js","sourceRoot":"","sources":["../../../src/api/batchProcessApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAMpC;IAA6C,mCAAO;IAApD;QAAA,qEASC;QARkB,iBAAW,GAAG,eAAe,CAAC;;IAQjD,CAAC;IANC,yCAAe,GAAf,UAAgB,EAAU;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,CAAE;SACnC,CAAC,CAAC;IACL,CAAC;IACH,sBAAC;AAAD,CAAC,AATD,CAA6C,iBAAO,GASnD"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseApi } from './baseApi';
|
|
2
|
-
export default class BatchProcessApi extends BaseApi {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
this.apiBasePath = 'batch-process';
|
|
6
|
-
}
|
|
7
|
-
getBatchProcess(id) {
|
|
8
|
-
return this.apiCall({
|
|
9
|
-
method: 'GET',
|
|
10
|
-
route: `${this.apiBasePath}/${id}`,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=batchProcessApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchProcessApi.js","sourceRoot":"","sources":["../../../src/api/batchProcessApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAApD;;QACmB,gBAAW,GAAG,eAAe,CAAC;IAQjD,CAAC;IANC,eAAe,CAAC,EAAU;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseApi } from './baseApi';
|
|
2
|
-
import { BatchProcessResponseDto } from '@onereach/types-contacts-api';
|
|
3
|
-
export default class BatchProcessApi extends BaseApi {
|
|
4
|
-
private readonly apiBasePath;
|
|
5
|
-
getBatchProcess(id: string): Promise<BatchProcessResponseDto>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=batchProcessApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchProcessApi.d.ts","sourceRoot":"","sources":["../../../src/api/batchProcessApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAE/C,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAM9D"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BaseApi } from './baseApi';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
BatchProcessResponseDto,
|
|
5
|
-
} from '@onereach/types-contacts-api';
|
|
6
|
-
|
|
7
|
-
export default class BatchProcessApi extends BaseApi {
|
|
8
|
-
private readonly apiBasePath = 'batch-process';
|
|
9
|
-
|
|
10
|
-
getBatchProcess(id: string): Promise<BatchProcessResponseDto> {
|
|
11
|
-
return this.apiCall({
|
|
12
|
-
method: 'GET',
|
|
13
|
-
route: `${this.apiBasePath}/${id}`,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|