@or-sdk/contacts 1.4.0-beta.647.0 → 1.4.1-beta.665.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/CHANGELOG.md +9 -0
- package/dist/cjs/Contacts.js +9 -0
- package/dist/cjs/Contacts.js.map +1 -1
- package/dist/cjs/api/contactApi.js +30 -9
- package/dist/cjs/api/contactApi.js.map +1 -1
- package/dist/cjs/api/contactBookApi.js +46 -7
- package/dist/cjs/api/contactBookApi.js.map +1 -1
- package/dist/cjs/apiError.js +31 -0
- package/dist/cjs/apiError.js.map +1 -0
- package/dist/esm/Contacts.js +9 -6
- package/dist/esm/Contacts.js.map +1 -1
- package/dist/esm/api/baseApi.js +0 -1
- package/dist/esm/api/baseApi.js.map +1 -1
- package/dist/esm/api/contactApi.js +20 -8
- package/dist/esm/api/contactApi.js.map +1 -1
- package/dist/esm/api/contactBookApi.js +36 -6
- package/dist/esm/api/contactBookApi.js.map +1 -1
- package/dist/esm/apiError.js +9 -0
- package/dist/esm/apiError.js.map +1 -0
- package/dist/types/Contacts.d.ts +2 -1
- package/dist/types/Contacts.d.ts.map +1 -1
- package/dist/types/api/contactApi.d.ts +7 -4
- package/dist/types/api/contactApi.d.ts.map +1 -1
- package/dist/types/api/contactBookApi.d.ts +8 -2
- package/dist/types/api/contactBookApi.d.ts.map +1 -1
- package/dist/types/apiError.d.ts +7 -0
- package/dist/types/apiError.d.ts.map +1 -0
- package/dist/types/types.d.ts +13 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/Contacts.ts +10 -1
- package/src/api/contactApi.ts +33 -11
- package/src/api/contactBookApi.ts +62 -8
- package/src/apiError.ts +13 -0
- package/src/types.ts +16 -0
- package/tsconfig.esm.json +1 -1
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
|
+
## [1.4.0](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/contacts@1.3.1...@or-sdk/contacts@1.4.0) (2022-09-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **@or-sdk/contacts:** update contacts sdk ([4a97728](https://gitlab.com/onereach/platform/or-sdk-next/commit/4a977284e2834e1ec8ec59783017742cf898d9cc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
### [1.3.1](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/contacts@1.3.0...@or-sdk/contacts@1.3.1) (2022-09-20)
|
|
7
16
|
|
|
8
17
|
|
package/dist/cjs/Contacts.js
CHANGED
|
@@ -19,6 +19,7 @@ exports.Contacts = void 0;
|
|
|
19
19
|
var base_1 = require("@or-sdk/base");
|
|
20
20
|
var constants_1 = require("./constants");
|
|
21
21
|
var api_1 = require("./api");
|
|
22
|
+
var apiError_1 = require("./apiError");
|
|
22
23
|
var Contacts = (function (_super) {
|
|
23
24
|
__extends(Contacts, _super);
|
|
24
25
|
function Contacts(params) {
|
|
@@ -39,6 +40,14 @@ var Contacts = (function (_super) {
|
|
|
39
40
|
_this.filterApi = new api_1.FilterApi(apiCall);
|
|
40
41
|
return _this;
|
|
41
42
|
}
|
|
43
|
+
Contacts.prototype.parseError = function (e) {
|
|
44
|
+
var _a;
|
|
45
|
+
if (e.isAxiosError && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
46
|
+
var _b = e.response.data, statusCode = _b.statusCode, message = _b.message;
|
|
47
|
+
return new apiError_1.ApiError(statusCode, message, e.stack);
|
|
48
|
+
}
|
|
49
|
+
return _super.prototype.parseError.call(this, e);
|
|
50
|
+
};
|
|
42
51
|
return Contacts;
|
|
43
52
|
}(base_1.Base));
|
|
44
53
|
exports.Contacts = Contacts;
|
package/dist/cjs/Contacts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qCAA8C;AAE9C,yCAAmD;AACnD,6BAOe;AACf,uCAAoC;AASpC;IAA8B,4BAAI;IAchC,kBAAY,MAAsB;QAAlC,iBAgBC;QAfS,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;;IAC1C,CAAC;IAED,6BAAU,GAAV,UAAW,CAAa;;QACtB,IAAG,CAAC,CAAC,YAAY,KAAI,MAAA,CAAC,CAAC,QAAQ,0CAAE,IAAI,CAAA,EAAC;YAC9B,IAAA,KAAyB,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAvC,UAAU,gBAAA,EAAG,OAAO,aAAmB,CAAC;YAC/C,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,AAvCD,CAA8B,WAAI,GAuCjC;AAvCY,4BAAQ"}
|
|
@@ -14,51 +14,72 @@ 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 __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
17
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
29
|
var baseApi_1 = require("./baseApi");
|
|
19
30
|
var ContactApi = (function (_super) {
|
|
20
31
|
__extends(ContactApi, _super);
|
|
21
32
|
function ContactApi() {
|
|
22
|
-
|
|
33
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
_this.apiBasePath = 'contact';
|
|
35
|
+
return _this;
|
|
23
36
|
}
|
|
24
37
|
ContactApi.prototype.getContact = function (id, params) {
|
|
25
38
|
return this.apiCall({
|
|
26
39
|
method: 'GET',
|
|
27
|
-
route: "
|
|
40
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
28
41
|
params: params,
|
|
29
42
|
});
|
|
30
43
|
};
|
|
31
44
|
ContactApi.prototype.getContactsList = function (params) {
|
|
32
45
|
return this.apiCall({
|
|
33
46
|
method: 'GET',
|
|
34
|
-
route:
|
|
35
|
-
params: params,
|
|
47
|
+
route: "".concat(this.apiBasePath),
|
|
48
|
+
params: __assign(__assign({}, params), (params.order && { order: "".concat(params.order.field, ":").concat(params.order.order) })),
|
|
36
49
|
});
|
|
37
50
|
};
|
|
38
51
|
ContactApi.prototype.updateContact = function (id, data) {
|
|
39
52
|
return this.apiCall({
|
|
40
53
|
method: 'PATCH',
|
|
41
|
-
route: "
|
|
54
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
55
|
+
data: data,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
ContactApi.prototype.deleteContact = function (id, data) {
|
|
59
|
+
return this.apiCall({
|
|
60
|
+
method: 'DELETE',
|
|
61
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
42
62
|
data: data,
|
|
43
63
|
});
|
|
44
64
|
};
|
|
45
|
-
ContactApi.prototype.
|
|
65
|
+
ContactApi.prototype.deleteMulti = function (data) {
|
|
46
66
|
return this.apiCall({
|
|
47
67
|
method: 'DELETE',
|
|
48
|
-
route: "
|
|
68
|
+
route: "".concat(this.apiBasePath),
|
|
69
|
+
data: data,
|
|
49
70
|
});
|
|
50
71
|
};
|
|
51
72
|
ContactApi.prototype.createContact = function (data) {
|
|
52
73
|
return this.apiCall({
|
|
53
74
|
method: 'POST',
|
|
54
|
-
route:
|
|
75
|
+
route: "".concat(this.apiBasePath),
|
|
55
76
|
data: data,
|
|
56
77
|
});
|
|
57
78
|
};
|
|
58
79
|
ContactApi.prototype.mergeContacts = function (id, data) {
|
|
59
80
|
return this.apiCall({
|
|
60
81
|
method: 'POST',
|
|
61
|
-
route: "
|
|
82
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/merge"),
|
|
62
83
|
data: data,
|
|
63
84
|
});
|
|
64
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{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AI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;YAC5B,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAMD,kCAAa,GAAb,UAAc,IAAsB;QAClC,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;IAOD,kCAAa,GAAb,UAAc,EAAU,EAAE,IAA2B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,WAAQ;YACxC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IACH,iBAAC;AAAD,CAAC,AA9FD,CAAwC,iBAAO,GA8F9C"}
|
|
@@ -14,43 +14,82 @@ 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 __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
17
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
29
|
var baseApi_1 = require("./baseApi");
|
|
19
30
|
var ContactBookApi = (function (_super) {
|
|
20
31
|
__extends(ContactBookApi, _super);
|
|
21
32
|
function ContactBookApi() {
|
|
22
|
-
|
|
33
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
_this.apiBasePath = 'contact-book';
|
|
35
|
+
return _this;
|
|
23
36
|
}
|
|
24
37
|
ContactBookApi.prototype.getContactBookList = function (params) {
|
|
25
38
|
return this.apiCall({
|
|
26
39
|
method: 'GET',
|
|
27
|
-
route:
|
|
28
|
-
params: params,
|
|
40
|
+
route: "".concat(this.apiBasePath),
|
|
41
|
+
params: __assign(__assign({}, params), (params.order && { order: "".concat(params.order.field, ":").concat(params.order.order) })),
|
|
29
42
|
});
|
|
30
43
|
};
|
|
31
44
|
ContactBookApi.prototype.getContactBook = function (id) {
|
|
32
45
|
return this.apiCall({
|
|
33
46
|
method: 'GET',
|
|
34
|
-
route: "
|
|
47
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
35
48
|
});
|
|
36
49
|
};
|
|
37
50
|
ContactBookApi.prototype.updateContactBook = function (id, data) {
|
|
38
51
|
return this.apiCall({
|
|
39
52
|
method: 'PATCH',
|
|
40
|
-
route: "
|
|
53
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
41
54
|
data: data,
|
|
42
55
|
});
|
|
43
56
|
};
|
|
44
57
|
ContactBookApi.prototype.deleteContactBook = function (id) {
|
|
45
58
|
return this.apiCall({
|
|
46
59
|
method: 'DELETE',
|
|
47
|
-
route: "
|
|
60
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
48
61
|
});
|
|
49
62
|
};
|
|
50
63
|
ContactBookApi.prototype.createContactBook = function (data) {
|
|
51
64
|
return this.apiCall({
|
|
52
65
|
method: 'POST',
|
|
53
|
-
route:
|
|
66
|
+
route: "".concat(this.apiBasePath),
|
|
67
|
+
data: data,
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
ContactBookApi.prototype.shareContactBook = function (id, data) {
|
|
71
|
+
return this.apiCall({
|
|
72
|
+
method: 'POST',
|
|
73
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/share"),
|
|
74
|
+
data: data,
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
ContactBookApi.prototype.getSharedBookMeta = function (id) {
|
|
78
|
+
return this.apiCall({
|
|
79
|
+
method: 'GET',
|
|
80
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/shared-book-meta"),
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
ContactBookApi.prototype.approveSharedBook = function (id) {
|
|
84
|
+
return this.apiCall({
|
|
85
|
+
method: 'POST',
|
|
86
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/approve"),
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
ContactBookApi.prototype.rejectShareBook = function (id, data) {
|
|
90
|
+
return this.apiCall({
|
|
91
|
+
method: 'POST',
|
|
92
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/reject"),
|
|
54
93
|
data: data,
|
|
55
94
|
});
|
|
56
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactBookApi.js","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contactBookApi.js","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,qCAAoC;AAGpC;IAA4C,kCAAO;IAAnD;QAAA,qEA+GC;QA9GkB,iBAAW,GAAG,cAAc,CAAC;;IA8GhD,CAAC;IAzGC,2CAAkB,GAAlB,UAAmB,MAAyB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;YAC5B,MAAM,wBACD,MAAM,GACN,CAAC,MAAM,CAAC,KAAK,IAAI,EAAC,KAAK,EAAE,UAAG,MAAM,CAAC,KAAK,CAAC,KAAK,cAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,EAAC,CAAC,CAC5E;SACF,CAAC,CAAC;IACL,CAAC;IAMD,u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AAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,aAAU;SAC3C,CAAC,CAAC;IACL,CAAC;IAOD,wCAAe,GAAf,UAAgB,EAAU,EAAE,IAA+B;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,YAAS;YACzC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IACH,qBAAC;AAAD,CAAC,AA/GD,CAA4C,iBAAO,GA+GlD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
exports.ApiError = void 0;
|
|
19
|
+
var ApiError = (function (_super) {
|
|
20
|
+
__extends(ApiError, _super);
|
|
21
|
+
function ApiError(statusCode, message, stack, translationKey) {
|
|
22
|
+
var _this = _super.call(this, message) || this;
|
|
23
|
+
_this.statusCode = statusCode;
|
|
24
|
+
_this.stack = stack;
|
|
25
|
+
_this.translationKey = translationKey;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
return ApiError;
|
|
29
|
+
}(Error));
|
|
30
|
+
exports.ApiError = ApiError;
|
|
31
|
+
//# sourceMappingURL=apiError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiError.js","sourceRoot":"","sources":["../../src/apiError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA;IAA8B,4BAAK;IACjC,kBACkB,UAAe,EAC/B,OAAe,EACC,KAAc,EACd,cAAuB;QAJzC,YAME,kBAAM,OAAO,CAAC,SACf;QANiB,gBAAU,GAAV,UAAU,CAAK;QAEf,WAAK,GAAL,KAAK,CAAS;QACd,oBAAc,GAAd,cAAc,CAAS;;IAGzC,CAAC;IACH,eAAC;AAAD,CAAC,AATD,CAA8B,KAAK,GASlC;AATY,4BAAQ"}
|
package/dist/esm/Contacts.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { Base } from '@or-sdk/base';
|
|
2
2
|
import { CONTACTS_SERVICE_KEY } from './constants';
|
|
3
3
|
import { ContactBookApi, MigrationsApi, ContactApi, FieldSchemaApi, SchemaPresetApi, FilterApi, } from './api';
|
|
4
|
+
import { ApiError } from "./apiError";
|
|
4
5
|
export class Contacts extends Base {
|
|
5
|
-
contactBookApi;
|
|
6
|
-
migrationsApi;
|
|
7
|
-
contactApi;
|
|
8
|
-
fieldSchemaApi;
|
|
9
|
-
schemaPresetApi;
|
|
10
|
-
filterApi;
|
|
11
6
|
constructor(params) {
|
|
12
7
|
const { token, discoveryUrl, contactsApiUrl } = params;
|
|
13
8
|
super({
|
|
@@ -24,5 +19,13 @@ export class Contacts extends Base {
|
|
|
24
19
|
this.schemaPresetApi = new SchemaPresetApi(apiCall);
|
|
25
20
|
this.filterApi = new FilterApi(apiCall);
|
|
26
21
|
}
|
|
22
|
+
parseError(e) {
|
|
23
|
+
var _a;
|
|
24
|
+
if (e.isAxiosError && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
25
|
+
const { statusCode, message } = e.response.data;
|
|
26
|
+
return new ApiError(statusCode, message, e.stack);
|
|
27
|
+
}
|
|
28
|
+
return super.parseError(e);
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
//# sourceMappingURL=Contacts.js.map
|
package/dist/esm/Contacts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,GACV,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AASpC,MAAM,OAAO,QAAS,SAAQ,IAAI;IAchC,YAAY,MAAsB;QAChC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;QACvD,KAAK,CAAC;YACJ,KAAK;YACL,YAAY;YACZ,UAAU,EAAE,oBAAoB;YAChC,UAAU,EAAE,cAAc;SAC3B,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,UAAU,CAAC,CAAa;;QACtB,IAAG,CAAC,CAAC,YAAY,KAAI,MAAA,CAAC,CAAC,QAAQ,0CAAE,IAAI,CAAA,EAAC;YACpC,MAAM,EAAC,UAAU,EAAG,OAAO,EAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC/C,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;SACnD;QACD,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/esm/api/baseApi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseApi.js","sourceRoot":"","sources":["../../../src/api/baseApi.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,OAAO;
|
|
1
|
+
{"version":3,"file":"baseApi.js","sourceRoot":"","sources":["../../../src/api/baseApi.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,OAAO;IAC3B,YAA+B,OAAgD;QAAhD,YAAO,GAAP,OAAO,CAAyC;IAC/E,CAAC;CACF"}
|
|
@@ -1,43 +1,55 @@
|
|
|
1
1
|
import { BaseApi } from './baseApi';
|
|
2
2
|
export default class ContactApi extends BaseApi {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.apiBasePath = 'contact';
|
|
6
|
+
}
|
|
3
7
|
getContact(id, params) {
|
|
4
8
|
return this.apiCall({
|
|
5
9
|
method: 'GET',
|
|
6
|
-
route:
|
|
10
|
+
route: `${this.apiBasePath}/${id}`,
|
|
7
11
|
params,
|
|
8
12
|
});
|
|
9
13
|
}
|
|
10
14
|
getContactsList(params) {
|
|
11
15
|
return this.apiCall({
|
|
12
16
|
method: 'GET',
|
|
13
|
-
route:
|
|
14
|
-
params,
|
|
17
|
+
route: `${this.apiBasePath}`,
|
|
18
|
+
params: Object.assign(Object.assign({}, params), (params.order && { order: `${params.order.field}:${params.order.order}` })),
|
|
15
19
|
});
|
|
16
20
|
}
|
|
17
21
|
updateContact(id, data) {
|
|
18
22
|
return this.apiCall({
|
|
19
23
|
method: 'PATCH',
|
|
20
|
-
route:
|
|
24
|
+
route: `${this.apiBasePath}/${id}`,
|
|
25
|
+
data,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
deleteContact(id, data) {
|
|
29
|
+
return this.apiCall({
|
|
30
|
+
method: 'DELETE',
|
|
31
|
+
route: `${this.apiBasePath}/${id}`,
|
|
21
32
|
data,
|
|
22
33
|
});
|
|
23
34
|
}
|
|
24
|
-
|
|
35
|
+
deleteMulti(data) {
|
|
25
36
|
return this.apiCall({
|
|
26
37
|
method: 'DELETE',
|
|
27
|
-
route:
|
|
38
|
+
route: `${this.apiBasePath}`,
|
|
39
|
+
data,
|
|
28
40
|
});
|
|
29
41
|
}
|
|
30
42
|
createContact(data) {
|
|
31
43
|
return this.apiCall({
|
|
32
44
|
method: 'POST',
|
|
33
|
-
route:
|
|
45
|
+
route: `${this.apiBasePath}`,
|
|
34
46
|
data,
|
|
35
47
|
});
|
|
36
48
|
}
|
|
37
49
|
mergeContacts(id, data) {
|
|
38
50
|
return this.apiCall({
|
|
39
51
|
method: 'POST',
|
|
40
|
-
route:
|
|
52
|
+
route: `${this.apiBasePath}/${id}/merge`,
|
|
41
53
|
data,
|
|
42
54
|
});
|
|
43
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts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;YAC5B,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAMD,aAAa,CAAC,IAAsB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;YAC5B,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAOD,aAAa,CAAC,EAAU,EAAE,IAA2B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,QAAQ;YACxC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,35 +1,65 @@
|
|
|
1
1
|
import { BaseApi } from './baseApi';
|
|
2
2
|
export default class ContactBookApi extends BaseApi {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.apiBasePath = 'contact-book';
|
|
6
|
+
}
|
|
3
7
|
getContactBookList(params) {
|
|
4
8
|
return this.apiCall({
|
|
5
9
|
method: 'GET',
|
|
6
|
-
route:
|
|
7
|
-
params,
|
|
10
|
+
route: `${this.apiBasePath}`,
|
|
11
|
+
params: Object.assign(Object.assign({}, params), (params.order && { order: `${params.order.field}:${params.order.order}` })),
|
|
8
12
|
});
|
|
9
13
|
}
|
|
10
14
|
getContactBook(id) {
|
|
11
15
|
return this.apiCall({
|
|
12
16
|
method: 'GET',
|
|
13
|
-
route:
|
|
17
|
+
route: `${this.apiBasePath}/${id}`,
|
|
14
18
|
});
|
|
15
19
|
}
|
|
16
20
|
updateContactBook(id, data) {
|
|
17
21
|
return this.apiCall({
|
|
18
22
|
method: 'PATCH',
|
|
19
|
-
route:
|
|
23
|
+
route: `${this.apiBasePath}/${id}`,
|
|
20
24
|
data,
|
|
21
25
|
});
|
|
22
26
|
}
|
|
23
27
|
deleteContactBook(id) {
|
|
24
28
|
return this.apiCall({
|
|
25
29
|
method: 'DELETE',
|
|
26
|
-
route:
|
|
30
|
+
route: `${this.apiBasePath}/${id}`,
|
|
27
31
|
});
|
|
28
32
|
}
|
|
29
33
|
createContactBook(data) {
|
|
30
34
|
return this.apiCall({
|
|
31
35
|
method: 'POST',
|
|
32
|
-
route:
|
|
36
|
+
route: `${this.apiBasePath}`,
|
|
37
|
+
data,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
shareContactBook(id, data) {
|
|
41
|
+
return this.apiCall({
|
|
42
|
+
method: 'POST',
|
|
43
|
+
route: `${this.apiBasePath}/${id}/share`,
|
|
44
|
+
data,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
getSharedBookMeta(id) {
|
|
48
|
+
return this.apiCall({
|
|
49
|
+
method: 'GET',
|
|
50
|
+
route: `${this.apiBasePath}/${id}/shared-book-meta`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
approveSharedBook(id) {
|
|
54
|
+
return this.apiCall({
|
|
55
|
+
method: 'POST',
|
|
56
|
+
route: `${this.apiBasePath}/${id}/approve`,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
rejectShareBook(id, data) {
|
|
60
|
+
return this.apiCall({
|
|
61
|
+
method: 'POST',
|
|
62
|
+
route: `${this.apiBasePath}/${id}/reject`,
|
|
33
63
|
data,
|
|
34
64
|
});
|
|
35
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactBookApi.js","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contactBookApi.js","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IAAnD;;QACmB,gBAAW,GAAG,cAAc,CAAC;IA8GhD,CAAC;IAzGC,kBAAkB,CAAC,MAAyB;QAC1C,OAAO,IAAI,CAAC,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,EAAU;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,mBAAmB;SACpD,CAAC,CAAC;IACL,CAAC;IAMD,iBAAiB,CAAC,EAAU;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,UAAU;SAC3C,CAAC,CAAC;IACL,CAAC;IAOD,eAAe,CAAC,EAAU,EAAE,IAA+B;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,SAAS;YACzC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiError.js","sourceRoot":"","sources":["../../src/apiError.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YACkB,UAAe,EAC/B,OAAe,EACC,KAAc,EACd,cAAuB;QAEvC,KAAK,CAAC,OAAO,CAAC,CAAC;QALC,eAAU,GAAV,UAAU,CAAK;QAEf,UAAK,GAAL,KAAK,CAAS;QACd,mBAAc,GAAd,cAAc,CAAS;IAGzC,CAAC;CACF"}
|
package/dist/types/Contacts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base } from '@or-sdk/base';
|
|
1
|
+
import { AxiosError, Base } from '@or-sdk/base';
|
|
2
2
|
import { ContactsConfig } from './types';
|
|
3
3
|
import { ContactBookApi, MigrationsApi, ContactApi, FieldSchemaApi, SchemaPresetApi, FilterApi } from './api';
|
|
4
4
|
export declare class Contacts extends Base {
|
|
@@ -9,5 +9,6 @@ export declare class Contacts extends Base {
|
|
|
9
9
|
readonly schemaPresetApi: SchemaPresetApi;
|
|
10
10
|
readonly filterApi: FilterApi;
|
|
11
11
|
constructor(params: ContactsConfig);
|
|
12
|
+
parseError(e: AxiosError): Error;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=Contacts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.d.ts","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"Contacts.d.ts","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,EACV,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;gBAOzB,MAAM,EAAE,cAAc;IAkBlC,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,KAAK;CAOjC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { BaseApi } from './baseApi';
|
|
2
|
-
import { ContactResponseDto, CreateContactDto, UpdateContactDto, ContactParamsDto, ContactListDto,
|
|
2
|
+
import { ContactResponseDto, CreateContactDto, UpdateContactDto, ContactParamsDto, ContactListDto, MergeContactParamsDto, DeleteContactParamsDto, DeleteContactMultiParamsDto } from '@onereach/types-contacts-api';
|
|
3
|
+
import { ContactSearchParams } from "../types";
|
|
3
4
|
export default class ContactApi extends BaseApi {
|
|
5
|
+
private readonly apiBasePath;
|
|
4
6
|
getContact(id: string, params: ContactParamsDto): Promise<ContactResponseDto>;
|
|
5
|
-
getContactsList(params:
|
|
7
|
+
getContactsList(params: ContactSearchParams): Promise<ContactListDto>;
|
|
6
8
|
updateContact(id: string, data: UpdateContactDto): Promise<ContactResponseDto>;
|
|
7
|
-
deleteContact(id: string): Promise<void>;
|
|
9
|
+
deleteContact(id: string, data: DeleteContactParamsDto): Promise<void>;
|
|
10
|
+
deleteMulti(data: DeleteContactMultiParamsDto): Promise<void>;
|
|
8
11
|
createContact(data: CreateContactDto): Promise<ContactResponseDto>;
|
|
9
|
-
mergeContacts(id: string, data: MergeContactParamsDto): Promise<
|
|
12
|
+
mergeContacts(id: string, data: MergeContactParamsDto): Promise<ContactResponseDto>;
|
|
10
13
|
}
|
|
11
14
|
//# sourceMappingURL=contactApi.d.ts.map
|
|
@@ -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,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,
|
|
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,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAOzC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAY7E,eAAe,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAgBrE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAa9E,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAatE,WAAW,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAY7D,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAalE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAOpF"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { ContactBookListDto, ContactBookResponseDto, CreateContactBookDto, UpdateContactBookDto,
|
|
1
|
+
import { ContactBookListDto, ContactBookResponseDto, CreateContactBookDto, UpdateContactBookDto, SharedBookResponseDto, ShareContactBookParamsDto } from '@onereach/types-contacts-api';
|
|
2
2
|
import { BaseApi } from './baseApi';
|
|
3
|
+
import { ContactBookParams } from "../types";
|
|
3
4
|
export default class ContactBookApi extends BaseApi {
|
|
4
|
-
|
|
5
|
+
private readonly apiBasePath;
|
|
6
|
+
getContactBookList(params: ContactBookParams): Promise<ContactBookListDto>;
|
|
5
7
|
getContactBook(id: string): Promise<ContactBookResponseDto>;
|
|
6
8
|
updateContactBook(id: string, data: UpdateContactBookDto): Promise<ContactBookResponseDto>;
|
|
7
9
|
deleteContactBook(id: string): Promise<void>;
|
|
8
10
|
createContactBook(data: CreateContactBookDto): Promise<ContactBookResponseDto>;
|
|
11
|
+
shareContactBook(id: string, data: ShareContactBookParamsDto): Promise<SharedBookResponseDto>;
|
|
12
|
+
getSharedBookMeta(id: string): Promise<SharedBookResponseDto[]>;
|
|
13
|
+
approveSharedBook(id: string): Promise<void>;
|
|
14
|
+
rejectShareBook(id: string, data: ShareContactBookParamsDto): Promise<void>;
|
|
9
15
|
}
|
|
10
16
|
//# sourceMappingURL=contactBookApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactBookApi.d.ts","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"contactBookApi.d.ts","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAK9C,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAe1E,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAY3D,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAY1F,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5C,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAa9E,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAY7F,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAW/D,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY5C,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAO5E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class ApiError extends Error {
|
|
2
|
+
readonly statusCode: any;
|
|
3
|
+
readonly stack?: string | undefined;
|
|
4
|
+
readonly translationKey?: string | undefined;
|
|
5
|
+
constructor(statusCode: any, message: string, stack?: string | undefined, translationKey?: string | undefined);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=apiError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiError.d.ts","sourceRoot":"","sources":["../../src/apiError.ts"],"names":[],"mappings":"AAGA,qBAAa,QAAS,SAAQ,KAAK;aAEf,UAAU,EAAE,GAAG;aAEf,KAAK,CAAC;aACN,cAAc,CAAC;gBAHf,UAAU,EAAE,GAAG,EAC/B,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,oBAAQ,EACd,cAAc,CAAC,oBAAQ;CAI1C"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { Token } from '@or-sdk/base';
|
|
2
|
+
import { ContactBookParamsDto, ContactSearchParamsDto } from "@onereach/types-contacts-api";
|
|
2
3
|
export declare type ContactsConfig = {
|
|
3
4
|
token: Token;
|
|
4
5
|
discoveryUrl?: string;
|
|
5
6
|
contactsApiUrl?: string;
|
|
6
7
|
};
|
|
8
|
+
export interface ContactBookParams extends Omit<ContactBookParamsDto, 'order'> {
|
|
9
|
+
order?: {
|
|
10
|
+
field: 'label' | 'created_at' | 'updated_at';
|
|
11
|
+
order: 'asc' | 'desc';
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface ContactSearchParams extends Omit<ContactSearchParamsDto, 'order'> {
|
|
15
|
+
order?: {
|
|
16
|
+
field: 'created_at' | 'updated_at';
|
|
17
|
+
order: 'asc' | 'desc';
|
|
18
|
+
};
|
|
19
|
+
}
|
|
7
20
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,oBAAoB,EAAE,sBAAsB,EAAC,MAAM,8BAA8B,CAAC;AAE1F,oBAAY,cAAc,GAAG;IAI3B,KAAK,EAAE,KAAK,CAAC;IAIb,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAGF,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAC5E,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,YAAY,CAAA;QAC5C,KAAK,EAAE,KAAK,GAAC,MAAM,CAAA;KACpB,CAAA;CACF;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAChF,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,YAAY,GAAG,YAAY,CAAA;QAClC,KAAK,EAAE,KAAK,GAAC,MAAM,CAAA;KACpB,CAAA;CACF"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.4.
|
|
2
|
+
"version": "1.4.1-beta.665.0",
|
|
3
3
|
"name": "@or-sdk/contacts",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dev": "pnpm build:watch:esm"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@onereach/types-contacts-api": "^1.
|
|
20
|
+
"@onereach/types-contacts-api": "^1.37.5-beta.833.0",
|
|
21
21
|
"concurrently": "^6.4.0",
|
|
22
22
|
"typescript": "^4.4.4"
|
|
23
23
|
},
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@or-sdk/base": "^0.
|
|
28
|
+
"@or-sdk/base": "^0.26.7"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/Contacts.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base
|
|
1
|
+
import {AxiosError, Base} from '@or-sdk/base';
|
|
2
2
|
import { ContactsConfig } from './types';
|
|
3
3
|
import { CONTACTS_SERVICE_KEY } from './constants';
|
|
4
4
|
import {
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
SchemaPresetApi,
|
|
10
10
|
FilterApi,
|
|
11
11
|
} from './api';
|
|
12
|
+
import {ApiError} from "./apiError";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* OneReach Contacts service client
|
|
@@ -48,4 +49,12 @@ export class Contacts extends Base {
|
|
|
48
49
|
this.schemaPresetApi = new SchemaPresetApi(apiCall);
|
|
49
50
|
this.filterApi = new FilterApi(apiCall);
|
|
50
51
|
}
|
|
52
|
+
|
|
53
|
+
parseError(e: AxiosError): Error {
|
|
54
|
+
if(e.isAxiosError && e.response?.data){
|
|
55
|
+
const {statusCode, message} = e.response.data;
|
|
56
|
+
return new ApiError(statusCode, message, e.stack);
|
|
57
|
+
}
|
|
58
|
+
return super.parseError(e);
|
|
59
|
+
}
|
|
51
60
|
}
|
package/src/api/contactApi.ts
CHANGED
|
@@ -5,11 +5,15 @@ import {
|
|
|
5
5
|
UpdateContactDto,
|
|
6
6
|
ContactParamsDto,
|
|
7
7
|
ContactListDto,
|
|
8
|
-
ContactSearchParamsDto,
|
|
9
8
|
MergeContactParamsDto,
|
|
9
|
+
DeleteContactParamsDto,
|
|
10
|
+
DeleteContactMultiParamsDto
|
|
10
11
|
} from '@onereach/types-contacts-api';
|
|
12
|
+
import {ContactSearchParams} from "../types";
|
|
11
13
|
|
|
12
14
|
export default class ContactApi extends BaseApi {
|
|
15
|
+
private readonly apiBasePath = 'contact';
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
18
|
* @description Get specific Contact
|
|
15
19
|
* @param params
|
|
@@ -18,7 +22,7 @@ export default class ContactApi extends BaseApi {
|
|
|
18
22
|
getContact(id: string, params: ContactParamsDto): Promise<ContactResponseDto> {
|
|
19
23
|
return this.apiCall({
|
|
20
24
|
method: 'GET',
|
|
21
|
-
route:
|
|
25
|
+
route: `${this.apiBasePath}/${id}`,
|
|
22
26
|
params,
|
|
23
27
|
});
|
|
24
28
|
}
|
|
@@ -27,11 +31,14 @@ export default class ContactApi extends BaseApi {
|
|
|
27
31
|
* @description Get list of Contacts for specific contactBook
|
|
28
32
|
* @param params
|
|
29
33
|
*/
|
|
30
|
-
getContactsList(params:
|
|
34
|
+
getContactsList(params: ContactSearchParams): Promise<ContactListDto> {
|
|
31
35
|
return this.apiCall({
|
|
32
36
|
method: 'GET',
|
|
33
|
-
route:
|
|
34
|
-
params
|
|
37
|
+
route: `${this.apiBasePath}`,
|
|
38
|
+
params: {
|
|
39
|
+
...params,
|
|
40
|
+
...(params.order && {order: `${params.order.field}:${params.order.order}`})
|
|
41
|
+
},
|
|
35
42
|
});
|
|
36
43
|
}
|
|
37
44
|
|
|
@@ -43,19 +50,34 @@ export default class ContactApi extends BaseApi {
|
|
|
43
50
|
updateContact(id: string, data: UpdateContactDto): Promise<ContactResponseDto> {
|
|
44
51
|
return this.apiCall({
|
|
45
52
|
method: 'PATCH',
|
|
46
|
-
route:
|
|
53
|
+
route: `${this.apiBasePath}/${id}`,
|
|
47
54
|
data,
|
|
48
55
|
});
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
/**
|
|
52
59
|
* @description Delete Contact
|
|
60
|
+
* @param data
|
|
53
61
|
* @param id
|
|
54
62
|
*/
|
|
55
|
-
deleteContact(id: string): Promise<void> {
|
|
63
|
+
deleteContact(id: string, data: DeleteContactParamsDto): Promise<void> {
|
|
56
64
|
return this.apiCall({
|
|
57
65
|
method: 'DELETE',
|
|
58
|
-
route:
|
|
66
|
+
route: `${this.apiBasePath}/${id}`,
|
|
67
|
+
data,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @description Delete Contact
|
|
74
|
+
* @param data
|
|
75
|
+
*/
|
|
76
|
+
deleteMulti(data: DeleteContactMultiParamsDto): Promise<void> {
|
|
77
|
+
return this.apiCall({
|
|
78
|
+
method: 'DELETE',
|
|
79
|
+
route: `${this.apiBasePath}`,
|
|
80
|
+
data,
|
|
59
81
|
});
|
|
60
82
|
}
|
|
61
83
|
|
|
@@ -66,7 +88,7 @@ export default class ContactApi extends BaseApi {
|
|
|
66
88
|
createContact(data: CreateContactDto): Promise<ContactResponseDto> {
|
|
67
89
|
return this.apiCall({
|
|
68
90
|
method: 'POST',
|
|
69
|
-
route:
|
|
91
|
+
route: `${this.apiBasePath}`,
|
|
70
92
|
data,
|
|
71
93
|
});
|
|
72
94
|
}
|
|
@@ -76,10 +98,10 @@ export default class ContactApi extends BaseApi {
|
|
|
76
98
|
* @param id Contact id TO which the data will be merged
|
|
77
99
|
* @param data
|
|
78
100
|
*/
|
|
79
|
-
mergeContacts(id: string, data: MergeContactParamsDto) {
|
|
101
|
+
mergeContacts(id: string, data: MergeContactParamsDto): Promise<ContactResponseDto> {
|
|
80
102
|
return this.apiCall({
|
|
81
103
|
method: 'POST',
|
|
82
|
-
route:
|
|
104
|
+
route: `${this.apiBasePath}/${id}/merge`,
|
|
83
105
|
data,
|
|
84
106
|
});
|
|
85
107
|
}
|
|
@@ -3,20 +3,26 @@ import {
|
|
|
3
3
|
ContactBookResponseDto,
|
|
4
4
|
CreateContactBookDto,
|
|
5
5
|
UpdateContactBookDto,
|
|
6
|
-
|
|
6
|
+
SharedBookResponseDto,
|
|
7
|
+
ShareContactBookParamsDto,
|
|
7
8
|
} from '@onereach/types-contacts-api';
|
|
8
9
|
import { BaseApi } from './baseApi';
|
|
10
|
+
import {ContactBookParams} from "../types";
|
|
9
11
|
|
|
10
12
|
export default class ContactBookApi extends BaseApi {
|
|
13
|
+
private readonly apiBasePath = 'contact-book';
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* @description Get list for ContactsBooks
|
|
14
17
|
*/
|
|
15
|
-
getContactBookList(params:
|
|
18
|
+
getContactBookList(params: ContactBookParams): Promise<ContactBookListDto> {
|
|
16
19
|
return this.apiCall({
|
|
17
20
|
method: 'GET',
|
|
18
|
-
route:
|
|
19
|
-
params
|
|
21
|
+
route: `${this.apiBasePath}`,
|
|
22
|
+
params: {
|
|
23
|
+
...params,
|
|
24
|
+
...(params.order && {order: `${params.order.field}:${params.order.order}`})
|
|
25
|
+
},
|
|
20
26
|
});
|
|
21
27
|
}
|
|
22
28
|
|
|
@@ -27,7 +33,7 @@ export default class ContactBookApi extends BaseApi {
|
|
|
27
33
|
getContactBook(id: string): Promise<ContactBookResponseDto> {
|
|
28
34
|
return this.apiCall({
|
|
29
35
|
method: 'GET',
|
|
30
|
-
route:
|
|
36
|
+
route: `${this.apiBasePath}/${id}`,
|
|
31
37
|
});
|
|
32
38
|
}
|
|
33
39
|
|
|
@@ -39,7 +45,7 @@ export default class ContactBookApi extends BaseApi {
|
|
|
39
45
|
updateContactBook(id: string, data: UpdateContactBookDto): Promise<ContactBookResponseDto> {
|
|
40
46
|
return this.apiCall({
|
|
41
47
|
method: 'PATCH',
|
|
42
|
-
route:
|
|
48
|
+
route: `${this.apiBasePath}/${id}`,
|
|
43
49
|
data,
|
|
44
50
|
});
|
|
45
51
|
}
|
|
@@ -51,7 +57,7 @@ export default class ContactBookApi extends BaseApi {
|
|
|
51
57
|
deleteContactBook(id: string): Promise<void> {
|
|
52
58
|
return this.apiCall({
|
|
53
59
|
method: 'DELETE',
|
|
54
|
-
route:
|
|
60
|
+
route: `${this.apiBasePath}/${id}`,
|
|
55
61
|
});
|
|
56
62
|
}
|
|
57
63
|
|
|
@@ -62,7 +68,55 @@ export default class ContactBookApi extends BaseApi {
|
|
|
62
68
|
createContactBook(data: CreateContactBookDto): Promise<ContactBookResponseDto> {
|
|
63
69
|
return this.apiCall({
|
|
64
70
|
method: 'POST',
|
|
65
|
-
route:
|
|
71
|
+
route: `${this.apiBasePath}`,
|
|
72
|
+
data,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Share ContactBook across account
|
|
78
|
+
* @param id
|
|
79
|
+
* @param data
|
|
80
|
+
*/
|
|
81
|
+
shareContactBook(id: string, data: ShareContactBookParamsDto): Promise<SharedBookResponseDto> {
|
|
82
|
+
return this.apiCall({
|
|
83
|
+
method: 'POST',
|
|
84
|
+
route: `${this.apiBasePath}/${id}/share`,
|
|
85
|
+
data,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get meta info about shared book
|
|
91
|
+
* @param id
|
|
92
|
+
*/
|
|
93
|
+
getSharedBookMeta(id: string): Promise<SharedBookResponseDto[]> {
|
|
94
|
+
return this.apiCall({
|
|
95
|
+
method: 'GET',
|
|
96
|
+
route: `${this.apiBasePath}/${id}/shared-book-meta`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Approve shared book from target side
|
|
102
|
+
* @param id
|
|
103
|
+
*/
|
|
104
|
+
approveSharedBook(id: string): Promise<void> {
|
|
105
|
+
return this.apiCall({
|
|
106
|
+
method: 'POST',
|
|
107
|
+
route: `${this.apiBasePath}/${id}/approve`,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Reject sharing book for target account
|
|
113
|
+
* @param id
|
|
114
|
+
* @param data
|
|
115
|
+
*/
|
|
116
|
+
rejectShareBook(id: string, data: ShareContactBookParamsDto): Promise<void> {
|
|
117
|
+
return this.apiCall({
|
|
118
|
+
method: 'POST',
|
|
119
|
+
route: `${this.apiBasePath}/${id}/reject`,
|
|
66
120
|
data,
|
|
67
121
|
});
|
|
68
122
|
}
|
package/src/apiError.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common parent for all api errors
|
|
3
|
+
*/
|
|
4
|
+
export class ApiError extends Error {
|
|
5
|
+
constructor(
|
|
6
|
+
public readonly statusCode: any,
|
|
7
|
+
message: string,
|
|
8
|
+
public readonly stack?: string,
|
|
9
|
+
public readonly translationKey?: string
|
|
10
|
+
) {
|
|
11
|
+
super(message);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Token } from '@or-sdk/base';
|
|
2
|
+
import {ContactBookParamsDto, ContactSearchParamsDto} from "@onereach/types-contacts-api";
|
|
2
3
|
|
|
3
4
|
export type ContactsConfig = {
|
|
4
5
|
/**
|
|
@@ -14,3 +15,18 @@ export type ContactsConfig = {
|
|
|
14
15
|
*/
|
|
15
16
|
contactsApiUrl?: string;
|
|
16
17
|
};
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export interface ContactBookParams extends Omit<ContactBookParamsDto, 'order'> {
|
|
21
|
+
order?: {
|
|
22
|
+
field: 'label' | 'created_at' | 'updated_at'
|
|
23
|
+
order: 'asc'|'desc'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ContactSearchParams extends Omit<ContactSearchParamsDto, 'order'> {
|
|
28
|
+
order?: {
|
|
29
|
+
field: 'created_at' | 'updated_at'
|
|
30
|
+
order: 'asc'|'desc'
|
|
31
|
+
}
|
|
32
|
+
}
|