@or-sdk/idw 7.3.0-beta.2664.0 → 7.3.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 CHANGED
@@ -3,6 +3,65 @@
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
+ ## [7.3.0](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@7.2.6...@or-sdk/idw@7.3.0) (2024-05-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * **idw:** Throw DomainNotFoundError for methods where no domains with a given slug ([2f94b39](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/2f94b39caab58c245274014c9ba4bcf715925c35))
12
+
13
+
14
+
15
+ ## [7.2.6](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@7.2.5...@or-sdk/idw@7.2.6) (2024-05-23)
16
+
17
+ **Note:** Version bump only for package @or-sdk/idw
18
+
19
+
20
+
21
+
22
+
23
+ ## [7.2.5](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@7.2.4...@or-sdk/idw@7.2.5) (2024-05-22)
24
+
25
+ **Note:** Version bump only for package @or-sdk/idw
26
+
27
+
28
+
29
+
30
+
31
+ ## [7.2.4](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@7.2.3...@or-sdk/idw@7.2.4) (2024-05-20)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * Sort package.json ([f00d2a0](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/f00d2a002636d40177270fdf056b58ceea30dbad))
37
+
38
+
39
+
40
+ ## [7.2.3](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@7.2.2...@or-sdk/idw@7.2.3) (2024-05-20)
41
+
42
+ **Note:** Version bump only for package @or-sdk/idw
43
+
44
+
45
+
46
+
47
+
48
+ ## [7.2.2](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@7.2.1...@or-sdk/idw@7.2.2) (2024-05-16)
49
+
50
+
51
+ ### Bug Fixes
52
+
53
+ * add rwc custom event name ([5bcdefa](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/5bcdefa96397115d31a1a5c3f5bb99525baa9362))
54
+
55
+
56
+
57
+ ## [7.2.1](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@7.2.0...@or-sdk/idw@7.2.1) (2024-05-14)
58
+
59
+ **Note:** Version bump only for package @or-sdk/idw
60
+
61
+
62
+
63
+
64
+
6
65
  ## [7.2.0](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/idw@7.1.11...@or-sdk/idw@7.2.0) (2024-04-11)
7
66
 
8
67
 
@@ -14,59 +14,179 @@ 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 __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 (g && (g = 0, op[0] && (_ = 0)), _) 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
+ };
17
53
  Object.defineProperty(exports, "__esModule", { value: true });
18
54
  exports.DomainApi = void 0;
55
+ var base_1 = require("@or-sdk/base");
19
56
  var BaseApi_1 = require("./BaseApi");
57
+ var errors_1 = require("./errors");
20
58
  var DomainApi = (function (_super) {
21
59
  __extends(DomainApi, _super);
22
60
  function DomainApi(config) {
23
61
  return _super.call(this, config) || this;
24
62
  }
25
- DomainApi.prototype.getDomain = function (id) {
26
- return this.providers.makeRequest({
27
- route: this.buildRoute('domain'),
28
- params: {
29
- id: id,
30
- },
63
+ DomainApi.prototype.getDomain = function (slug) {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ return __generator(this, function (_a) {
66
+ try {
67
+ return [2, this.providers.makeRequest({
68
+ route: this.buildRoute('domain'),
69
+ params: {
70
+ id: slug,
71
+ },
72
+ })];
73
+ }
74
+ catch (error) {
75
+ throw this._parseError(error, { notFoundMessage: "No domains with slug: '".concat(slug, "'") });
76
+ }
77
+ return [2];
78
+ });
31
79
  });
32
80
  };
33
81
  DomainApi.prototype.getAllDomains = function () {
34
- return this.providers.makeRequest({
35
- route: this.buildRoute('domains'),
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ return __generator(this, function (_a) {
84
+ switch (_a.label) {
85
+ case 0: return [4, this.providers.makeRequest({
86
+ route: this.buildRoute('domains'),
87
+ })];
88
+ case 1: return [2, _a.sent()];
89
+ }
90
+ });
36
91
  });
37
92
  };
38
- DomainApi.prototype.deleteDomain = function (id) {
39
- return this.providers.makeRequest({
40
- route: this.buildRoute('domain'),
41
- method: 'DELETE',
42
- params: {
43
- id: id,
44
- },
93
+ DomainApi.prototype.deleteDomain = function (slug) {
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ var error_1;
96
+ return __generator(this, function (_a) {
97
+ switch (_a.label) {
98
+ case 0:
99
+ _a.trys.push([0, 2, , 3]);
100
+ return [4, this.providers.makeRequest({
101
+ route: this.buildRoute('domain'),
102
+ method: 'DELETE',
103
+ params: {
104
+ id: slug,
105
+ },
106
+ })];
107
+ case 1: return [2, _a.sent()];
108
+ case 2:
109
+ error_1 = _a.sent();
110
+ throw this._parseError(error_1, { notFoundMessage: "No domains with slug: '".concat(slug, "'") });
111
+ case 3: return [2];
112
+ }
113
+ });
45
114
  });
46
115
  };
47
116
  DomainApi.prototype.deleteAllDomains = function () {
48
- return this.providers.makeRequest({
49
- route: this.buildRoute('domains'),
50
- method: 'DELETE',
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0: return [4, this.providers.makeRequest({
121
+ route: this.buildRoute('domains'),
122
+ method: 'DELETE',
123
+ })];
124
+ case 1: return [2, _a.sent()];
125
+ }
126
+ });
127
+ });
128
+ };
129
+ DomainApi.prototype.patchDomain = function (slug, data) {
130
+ return __awaiter(this, void 0, void 0, function () {
131
+ var error_2;
132
+ return __generator(this, function (_a) {
133
+ switch (_a.label) {
134
+ case 0:
135
+ _a.trys.push([0, 2, , 3]);
136
+ return [4, this.providers.makeRequest({
137
+ route: this.buildRoute('domain'),
138
+ method: 'PATCH',
139
+ data: data,
140
+ params: {
141
+ id: slug,
142
+ },
143
+ })];
144
+ case 1: return [2, _a.sent()];
145
+ case 2:
146
+ error_2 = _a.sent();
147
+ throw this._parseError(error_2, { notFoundMessage: "No domains with slug: '".concat(slug, "'") });
148
+ case 3: return [2];
149
+ }
150
+ });
51
151
  });
52
152
  };
53
- DomainApi.prototype.updateDomain = function (id, data) {
54
- return this.providers.makeRequest({
55
- route: this.buildRoute('domain'),
56
- method: 'PATCH',
57
- data: data,
58
- params: {
59
- id: id,
60
- },
153
+ DomainApi.prototype.updateDomain = function (slug, data) {
154
+ return __awaiter(this, void 0, void 0, function () {
155
+ return __generator(this, function (_a) {
156
+ return [2, this.patchDomain(slug, data)];
157
+ });
61
158
  });
62
159
  };
63
160
  DomainApi.prototype.createDomain = function (data) {
64
- return this.providers.makeRequest({
65
- route: this.buildRoute('domain'),
66
- method: 'POST',
67
- data: data,
161
+ return __awaiter(this, void 0, void 0, function () {
162
+ return __generator(this, function (_a) {
163
+ switch (_a.label) {
164
+ case 0: return [4, this.providers.makeRequest({
165
+ route: this.buildRoute('domain'),
166
+ method: 'POST',
167
+ data: data,
168
+ })];
169
+ case 1: return [2, _a.sent()];
170
+ }
171
+ });
68
172
  });
69
173
  };
174
+ DomainApi.prototype._parseError = function (error, _a) {
175
+ var _b, _c;
176
+ var _d = _a === void 0 ? {} : _a, _e = _d.notFoundMessage, notFoundMessage = _e === void 0 ? 'Domain not found' : _e;
177
+ if (!(error instanceof Error))
178
+ throw error;
179
+ if (error instanceof base_1.AxiosError && ((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 404) {
180
+ return new errors_1.DomainNotFoundError(notFoundMessage, { cause: error });
181
+ }
182
+ if (error.cause instanceof base_1.AxiosError && ((_c = error.cause.response) === null || _c === void 0 ? void 0 : _c.status) === 404) {
183
+ return new errors_1.DomainNotFoundError(notFoundMessage, { cause: error.cause });
184
+ }
185
+ if (error instanceof base_1.AxiosError) {
186
+ return new errors_1.DomainError((0, base_1.parseAxiosErrorMessage)(error), { cause: error });
187
+ }
188
+ return error;
189
+ };
70
190
  return DomainApi;
71
191
  }(BaseApi_1.BaseApi));
72
192
  exports.DomainApi = DomainApi;
@@ -1 +1 @@
1
- {"version":3,"file":"domainApi.js","sourceRoot":"","sources":["../../../src/api/domainApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAOA,qCAAoC;AAEpC;IAA+B,6BAAO;IACpC,mBAAY,MAAqB;QAC/B,OAAA,MAAK,YAAC,MAAM,CAAC,SAAC;IAChB,CAAC;IAMD,6BAAS,GAAT,UAAU,EAAU;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChC,MAAM,EAAE;gBACN,EAAE,IAAA;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAMD,iCAAa,GAAb;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;SAClC,CAAC,CAAC;IACL,CAAC;IAMD,gCAAY,GAAZ,UAAa,EAAU;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChC,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,EAAE,IAAA;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAKD,oCAAgB,GAAhB;QACE,OAAO,IAAI,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AAE,CAAC,CAAC;QAC1E,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IACH,gBAAC;AAAD,CAAC,AAvHD,CAA+B,iBAAO,GAuHrC;AAvHY,8BAAS"}
@@ -0,0 +1,36 @@
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.DomainNotFoundError = exports.DomainError = void 0;
19
+ var base_1 = require("@or-sdk/base");
20
+ var DomainError = (function (_super) {
21
+ __extends(DomainError, _super);
22
+ function DomainError() {
23
+ return _super !== null && _super.apply(this, arguments) || this;
24
+ }
25
+ return DomainError;
26
+ }(base_1.BaseError));
27
+ exports.DomainError = DomainError;
28
+ var DomainNotFoundError = (function (_super) {
29
+ __extends(DomainNotFoundError, _super);
30
+ function DomainNotFoundError() {
31
+ return _super !== null && _super.apply(this, arguments) || this;
32
+ }
33
+ return DomainNotFoundError;
34
+ }(DomainError));
35
+ exports.DomainNotFoundError = DomainNotFoundError;
36
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qCAAyC;AAEzC;IAAiC,+BAAS;IAA1C;;IAA4C,CAAC;IAAD,kBAAC;AAAD,CAAC,AAA7C,CAAiC,gBAAS,GAAG;AAAhC,kCAAW;AACxB;IAAyC,uCAAW;IAApD;;IAAsD,CAAC;IAAD,0BAAC;AAAD,CAAC,AAAvD,CAAyC,WAAW,GAAG;AAA1C,kDAAmB"}
@@ -1,6 +1,21 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  exports.FlowApi = exports.IdwRwcApi = exports.IdwDbApi = exports.IdwInfoApi = exports.MigrationApi = exports.DomainRelationshipApi = exports.DomainApi = exports.ChannelApi = exports.MemoryApi = exports.SkillApi = void 0;
18
+ __exportStar(require("./errors"), exports);
4
19
  var skillApi_1 = require("./skillApi");
5
20
  Object.defineProperty(exports, "SkillApi", { enumerable: true, get: function () { return skillApi_1.SkillApi; } });
6
21
  var memoryApi_1 = require("./memoryApi");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdwExceptionsCodes = exports.IDW_PROVIDER_NAME_SPACE = exports.SERVICE_KEY = void 0;
3
+ exports.RwcActionEvent = exports.IdwExceptionsCodes = exports.IDW_PROVIDER_NAME_SPACE = exports.SERVICE_KEY = void 0;
4
4
  exports.SERVICE_KEY = 'idw';
5
5
  exports.IDW_PROVIDER_NAME_SPACE = 'idw-provider';
6
6
  var IdwExceptionsCodes;
7
7
  (function (IdwExceptionsCodes) {
8
8
  IdwExceptionsCodes["NON_IDW_ACCOUNT"] = "NON_IDW_ACCOUNT";
9
9
  })(IdwExceptionsCodes || (exports.IdwExceptionsCodes = IdwExceptionsCodes = {}));
10
+ exports.RwcActionEvent = 'rwc-action-event';
10
11
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,KAAK,CAAC;AACpB,QAAA,uBAAuB,GAAG,cAAc,CAAC;AAEtD,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC5B,yDAAkC,CAAA;AACpC,CAAC,EAFW,kBAAkB,kCAAlB,kBAAkB,QAE7B"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,KAAK,CAAC;AACpB,QAAA,uBAAuB,GAAG,cAAc,CAAC;AAEtD,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC5B,yDAAmC,CAAA;AACrC,CAAC,EAFW,kBAAkB,kCAAlB,kBAAkB,QAE7B;AAEY,QAAA,cAAc,GAAG,kBAAkB,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -14,10 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.IdwExceptionsCodes = exports.IdwApi = void 0;
17
+ exports.IdwApi = void 0;
18
+ __exportStar(require("./api"), exports);
18
19
  __exportStar(require("./types"), exports);
19
20
  var idwApi_1 = require("./idwApi");
20
21
  Object.defineProperty(exports, "IdwApi", { enumerable: true, get: function () { return idwApi_1.IdwApi; } });
21
- var constants_1 = require("./constants");
22
- Object.defineProperty(exports, "IdwExceptionsCodes", { enumerable: true, get: function () { return constants_1.IdwExceptionsCodes; } });
22
+ __exportStar(require("./constants"), exports);
23
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,yCAAiD;AAAxC,+GAAA,kBAAkB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB;AACxB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,8CAA4B"}
@@ -1,52 +1,110 @@
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
+ import { AxiosError, parseAxiosErrorMessage } from '@or-sdk/base';
1
11
  import { BaseApi } from './BaseApi';
12
+ import { DomainError, DomainNotFoundError } from './errors';
2
13
  export class DomainApi extends BaseApi {
3
14
  constructor(config) {
4
15
  super(config);
5
16
  }
6
- getDomain(id) {
7
- return this.providers.makeRequest({
8
- route: this.buildRoute('domain'),
9
- params: {
10
- id,
11
- },
17
+ getDomain(slug) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ return this.providers.makeRequest({
21
+ route: this.buildRoute('domain'),
22
+ params: {
23
+ id: slug,
24
+ },
25
+ });
26
+ }
27
+ catch (error) {
28
+ throw this._parseError(error, { notFoundMessage: `No domains with slug: '${slug}'` });
29
+ }
12
30
  });
13
31
  }
14
32
  getAllDomains() {
15
- return this.providers.makeRequest({
16
- route: this.buildRoute('domains'),
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ return yield this.providers.makeRequest({
35
+ route: this.buildRoute('domains'),
36
+ });
17
37
  });
18
38
  }
19
- deleteDomain(id) {
20
- return this.providers.makeRequest({
21
- route: this.buildRoute('domain'),
22
- method: 'DELETE',
23
- params: {
24
- id,
25
- },
39
+ deleteDomain(slug) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ try {
42
+ return yield this.providers.makeRequest({
43
+ route: this.buildRoute('domain'),
44
+ method: 'DELETE',
45
+ params: {
46
+ id: slug,
47
+ },
48
+ });
49
+ }
50
+ catch (error) {
51
+ throw this._parseError(error, { notFoundMessage: `No domains with slug: '${slug}'` });
52
+ }
26
53
  });
27
54
  }
28
55
  deleteAllDomains() {
29
- return this.providers.makeRequest({
30
- route: this.buildRoute('domains'),
31
- method: 'DELETE',
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ return yield this.providers.makeRequest({
58
+ route: this.buildRoute('domains'),
59
+ method: 'DELETE',
60
+ });
32
61
  });
33
62
  }
34
- updateDomain(id, data) {
35
- return this.providers.makeRequest({
36
- route: this.buildRoute('domain'),
37
- method: 'PATCH',
38
- data,
39
- params: {
40
- id,
41
- },
63
+ patchDomain(slug, data) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ try {
66
+ return yield this.providers.makeRequest({
67
+ route: this.buildRoute('domain'),
68
+ method: 'PATCH',
69
+ data,
70
+ params: {
71
+ id: slug,
72
+ },
73
+ });
74
+ }
75
+ catch (error) {
76
+ throw this._parseError(error, { notFoundMessage: `No domains with slug: '${slug}'` });
77
+ }
78
+ });
79
+ }
80
+ updateDomain(slug, data) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ return this.patchDomain(slug, data);
42
83
  });
43
84
  }
44
85
  createDomain(data) {
45
- return this.providers.makeRequest({
46
- route: this.buildRoute('domain'),
47
- method: 'POST',
48
- data,
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ return yield this.providers.makeRequest({
88
+ route: this.buildRoute('domain'),
89
+ method: 'POST',
90
+ data,
91
+ });
49
92
  });
50
93
  }
94
+ _parseError(error, { notFoundMessage = 'Domain not found' } = {}) {
95
+ var _a, _b;
96
+ if (!(error instanceof Error))
97
+ throw error;
98
+ if (error instanceof AxiosError && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
99
+ return new DomainNotFoundError(notFoundMessage, { cause: error });
100
+ }
101
+ if (error.cause instanceof AxiosError && ((_b = error.cause.response) === null || _b === void 0 ? void 0 : _b.status) === 404) {
102
+ return new DomainNotFoundError(notFoundMessage, { cause: error.cause });
103
+ }
104
+ if (error instanceof AxiosError) {
105
+ return new DomainError(parseAxiosErrorMessage(error), { cause: error });
106
+ }
107
+ return error;
108
+ }
51
109
  }
52
110
  //# sourceMappingURL=domainApi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"domainApi.js","sourceRoot":"","sources":["../../../src/api/domainApi.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,SAAU,SAAQ,OAAO;IACpC,YAAY,MAAqB;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAMD,SAAS,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChC,MAAM,EAAE;gBACN,EAAE;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAMD,aAAa;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;SAClC,CAAC,CAAC;IACL,CAAC;IAMD,YAAY,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YAChC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChC,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,EAAE;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAKD,gBAAgB;QACd,OAAO,IAAI,CAAC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 import { BaseError } from '@or-sdk/base';
2
+ export class DomainError extends BaseError {
3
+ }
4
+ export class DomainNotFoundError extends DomainError {
5
+ }
6
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,OAAO,WAAY,SAAQ,SAAS;CAAG;AAC7C,MAAM,OAAO,mBAAoB,SAAQ,WAAW;CAAG"}
@@ -1,3 +1,4 @@
1
+ export * from './errors';
1
2
  export { SkillApi } from './skillApi';
2
3
  export { MemoryApi } from './memoryApi';
3
4
  export { ChannelApi } from './channelApi';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -4,4 +4,5 @@ export var IdwExceptionsCodes;
4
4
  (function (IdwExceptionsCodes) {
5
5
  IdwExceptionsCodes["NON_IDW_ACCOUNT"] = "NON_IDW_ACCOUNT";
6
6
  })(IdwExceptionsCodes || (IdwExceptionsCodes = {}));
7
+ export const RwcActionEvent = 'rwc-action-event';
7
8
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AACjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAEtD,MAAM,CAAN,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC5B,yDAAkC,CAAA;AACpC,CAAC,EAFW,kBAAkB,KAAlB,kBAAkB,QAE7B"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AACjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAEtD,MAAM,CAAN,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC5B,yDAAmC,CAAA;AACrC,CAAC,EAFW,kBAAkB,KAAlB,kBAAkB,QAE7B;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
+ export * from './api';
1
2
  export * from './types';
2
3
  export { IdwApi } from './idwApi';
3
- export { IdwExceptionsCodes } from './constants';
4
+ export * from './constants';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,aAAa,CAAC"}
@@ -2,11 +2,13 @@ import { Domain, ListDomains, DomainUpdateData, DomainCreateData, DomainWithEnti
2
2
  import { BaseApi } from './BaseApi';
3
3
  export declare class DomainApi extends BaseApi {
4
4
  constructor(config: IDWBaseConfig);
5
- getDomain(id: string): Promise<DomainWithEntities>;
5
+ getDomain(slug: string): Promise<DomainWithEntities>;
6
6
  getAllDomains(): Promise<ListDomains>;
7
- deleteDomain(id: string): Promise<void>;
7
+ deleteDomain(slug: string): Promise<void>;
8
8
  deleteAllDomains(): Promise<void>;
9
- updateDomain(id: string, data: DomainUpdateData): Promise<Domain>;
9
+ patchDomain(slug: string, data: DomainUpdateData): Promise<Domain>;
10
+ updateDomain(slug: string, data: DomainUpdateData): Promise<Domain>;
10
11
  createDomain(data: DomainCreateData): Promise<Domain>;
12
+ private _parseError;
11
13
  }
12
14
  //# sourceMappingURL=domainApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"domainApi.d.ts","sourceRoot":"","sources":["../../../src/api/domainApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EAC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,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAQnE,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAQlE,OAAO,CAAC,WAAW;CAkBpB"}
@@ -0,0 +1,6 @@
1
+ import { BaseError } from '@or-sdk/base';
2
+ export declare class DomainError extends BaseError {
3
+ }
4
+ export declare class DomainNotFoundError extends DomainError {
5
+ }
6
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,qBAAa,WAAY,SAAQ,SAAS;CAAG;AAC7C,qBAAa,mBAAoB,SAAQ,WAAW;CAAG"}
@@ -1,3 +1,4 @@
1
+ export * from './errors';
1
2
  export { SkillApi } from './skillApi';
2
3
  export { MemoryApi } from './memoryApi';
3
4
  export { ChannelApi } from './channelApi';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -3,4 +3,5 @@ export declare const IDW_PROVIDER_NAME_SPACE = "idw-provider";
3
3
  export declare enum IdwExceptionsCodes {
4
4
  NON_IDW_ACCOUNT = "NON_IDW_ACCOUNT"
5
5
  }
6
+ export declare const RwcActionEvent = "rwc-action-event";
6
7
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAQ,CAAC;AACjC,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,oBAAY,kBAAkB;IAC5B,eAAe,oBAAmB;CACnC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAQ,CAAC;AACjC,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,oBAAY,kBAAkB;IAC5B,eAAe,oBAAoB;CACpC;AAED,eAAO,MAAM,cAAc,qBAAqB,CAAC"}
@@ -1,4 +1,5 @@
1
+ export * from './api';
1
2
  export * from './types';
2
3
  export { IdwApi } from './idwApi';
3
- export { IdwExceptionsCodes } from './constants';
4
+ export * from './constants';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
- "version": "7.3.0-beta.2664.0",
3
2
  "name": "@or-sdk/idw",
3
+ "version": "7.3.0",
4
+ "license": "Apache-2.0",
4
5
  "main": "dist/cjs/index.js",
5
6
  "module": "dist/esm/index.js",
6
7
  "types": "dist/types/index.d.ts",
@@ -16,6 +17,11 @@
16
17
  "clean": "rm -rf ./dist",
17
18
  "dev": "pnpm build:watch:esm"
18
19
  },
20
+ "dependencies": {
21
+ "@or-sdk/base": "^0.38.0",
22
+ "@or-sdk/deployer": "^1.3.7",
23
+ "@or-sdk/providers": "^0.2.32"
24
+ },
19
25
  "devDependencies": {
20
26
  "concurrently": "8.2.2",
21
27
  "typescript": "5.4.4"
@@ -23,9 +29,5 @@
23
29
  "publishConfig": {
24
30
  "access": "public"
25
31
  },
26
- "dependencies": {
27
- "@or-sdk/base": "^0.35.2",
28
- "@or-sdk/deployer": "^1.3.1",
29
- "@or-sdk/providers": "^0.2.26"
30
- }
32
+ "gitHead": "2c4589aabebf8cc312a8dfc21eaf5faefa0ae350"
31
33
  }
@@ -1,3 +1,4 @@
1
+ import { AxiosError, parseAxiosErrorMessage } from '@or-sdk/base';
1
2
  import {
2
3
  Domain,
3
4
  ListDomains,
@@ -6,6 +7,7 @@ import {
6
7
  DomainWithEntities, IDWBaseConfig,
7
8
  } from '../types';
8
9
  import { BaseApi } from './BaseApi';
10
+ import { DomainError, DomainNotFoundError } from './errors';
9
11
 
10
12
  export class DomainApi extends BaseApi {
11
13
  constructor(config: IDWBaseConfig) {
@@ -14,77 +16,116 @@ export class DomainApi extends BaseApi {
14
16
 
15
17
  /**
16
18
  * @description Get specific domain
17
- * @param id
19
+ * @param slug
18
20
  */
19
- getDomain(id: string): Promise<DomainWithEntities> {
20
- return this.providers.makeRequest({
21
- route: this.buildRoute('domain'),
22
- params: {
23
- id,
24
- },
25
- });
21
+ public async getDomain(slug: string): Promise<DomainWithEntities> {
22
+ try {
23
+ return this.providers.makeRequest<DomainWithEntities>({
24
+ route: this.buildRoute('domain'),
25
+ params: {
26
+ id: slug,
27
+ },
28
+ });
29
+ } catch (error) {
30
+ throw this._parseError(error, { notFoundMessage: `No domains with slug: '${slug}'` });
31
+ }
26
32
  }
27
33
 
28
-
29
34
  /**
30
35
  * @description Get all domains
31
36
  */
32
- getAllDomains(): Promise<ListDomains> {
33
- return this.providers.makeRequest({
37
+ public async getAllDomains(): Promise<ListDomains> {
38
+ return await this.providers.makeRequest<ListDomains>({
34
39
  route: this.buildRoute('domains'),
35
40
  });
36
41
  }
37
42
 
38
43
  /**
39
44
  * @description Delete specific domain
40
- * @param id
45
+ * @param slug
41
46
  */
42
- deleteDomain(id: string): Promise<void> {
43
- return this.providers.makeRequest({
44
- route: this.buildRoute('domain'),
45
- method: 'DELETE',
46
- params: {
47
- id,
48
- },
49
- });
47
+ public async deleteDomain(slug: string): Promise<void> {
48
+ try {
49
+ return await this.providers.makeRequest({
50
+ route: this.buildRoute('domain'),
51
+ method: 'DELETE',
52
+ params: {
53
+ id: slug,
54
+ },
55
+ });
56
+ } catch (error) {
57
+ throw this._parseError(error, { notFoundMessage: `No domains with slug: '${slug}'` });
58
+ }
50
59
  }
51
60
 
52
61
  /**
53
62
  * @description Delete all domains
54
63
  */
55
- deleteAllDomains(): Promise<void> {
56
- return this.providers.makeRequest({
64
+ public async deleteAllDomains(): Promise<void> {
65
+ return await this.providers.makeRequest({
57
66
  route: this.buildRoute('domains'),
58
67
  method: 'DELETE',
59
68
  });
60
69
  }
61
70
 
62
71
  /**
63
- * @description update specific domain
64
- * @param id
72
+ * @description Patch specific domain's name and/or abbreviation
73
+ * @param slug
65
74
  * @param data
66
75
  */
67
- updateDomain(id: string, data: DomainUpdateData): Promise<Domain> {
68
- return this.providers.makeRequest({
69
- route: this.buildRoute('domain'),
70
- method: 'PATCH',
71
- data,
72
- params: {
73
- id,
74
- },
75
- });
76
+ public async patchDomain(slug: string, data: DomainUpdateData): Promise<Domain> {
77
+ try {
78
+ return await this.providers.makeRequest<Domain>({
79
+ route: this.buildRoute('domain'),
80
+ method: 'PATCH',
81
+ data,
82
+ params: {
83
+ id: slug,
84
+ },
85
+ });
86
+ } catch (error) {
87
+ throw this._parseError(error, { notFoundMessage: `No domains with slug: '${slug}'` });
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @description Update specific domain
93
+ * @param slug
94
+ * @param data
95
+ * @deprecated use `patchDomain` instead
96
+ */
97
+ public async updateDomain(slug: string, data: DomainUpdateData): Promise<Domain> {
98
+ return this.patchDomain(slug, data);
76
99
  }
77
100
 
78
101
  /**
79
102
  * @description create domain
80
103
  * @param data
81
104
  */
82
- createDomain(data: DomainCreateData): Promise<Domain> {
83
- return this.providers.makeRequest({
105
+ public async createDomain(data: DomainCreateData): Promise<Domain> {
106
+ return await this.providers.makeRequest<Domain>({
84
107
  route: this.buildRoute('domain'),
85
108
  method: 'POST',
86
109
  data,
87
110
  });
88
111
  }
89
- }
90
112
 
113
+ private _parseError(
114
+ error: Error | unknown,
115
+ { notFoundMessage = 'Domain not found' } = {},
116
+ ): DomainError | DomainNotFoundError | Error {
117
+ if (!(error instanceof Error)) throw error;
118
+
119
+ if (error instanceof AxiosError && error.response?.status === 404) {
120
+ return new DomainNotFoundError(notFoundMessage, { cause: error });
121
+ }
122
+ if (error.cause instanceof AxiosError && error.cause.response?.status === 404) {
123
+ return new DomainNotFoundError(notFoundMessage, { cause: error.cause });
124
+ }
125
+ if (error instanceof AxiosError) {
126
+ return new DomainError(parseAxiosErrorMessage(error), { cause: error });
127
+ }
128
+
129
+ return error;
130
+ }
131
+ }
@@ -0,0 +1,4 @@
1
+ import { BaseError } from '@or-sdk/base';
2
+
3
+ export class DomainError extends BaseError {}
4
+ export class DomainNotFoundError extends DomainError {}
package/src/api/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './errors';
1
2
  export { SkillApi } from './skillApi';
2
3
  export { MemoryApi } from './memoryApi';
3
4
  export { ChannelApi } from './channelApi';
package/src/constants.ts CHANGED
@@ -2,5 +2,7 @@ export const SERVICE_KEY = 'idw';
2
2
  export const IDW_PROVIDER_NAME_SPACE = 'idw-provider';
3
3
 
4
4
  export enum IdwExceptionsCodes {
5
- NON_IDW_ACCOUNT= 'NON_IDW_ACCOUNT',
5
+ NON_IDW_ACCOUNT = 'NON_IDW_ACCOUNT',
6
6
  }
7
+
8
+ export const RwcActionEvent = 'rwc-action-event';
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './api';
1
2
  export * from './types';
2
3
  export { IdwApi } from './idwApi';
3
- export { IdwExceptionsCodes } from './constants';
4
+ export * from './constants';