@or-sdk/lookup 1.1.0 → 1.2.0-beta.1897.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/README.md +28 -30
- package/dist/cjs/Lookup.js +71 -114
- package/dist/cjs/Lookup.js.map +1 -1
- package/dist/cjs/__tests__/QnA.collections.spec.js +0 -20
- package/dist/cjs/__tests__/QnA.collections.spec.js.map +1 -1
- package/dist/cjs/error-parser/OrNetworkError.js +1 -9
- package/dist/cjs/error-parser/OrNetworkError.js.map +1 -1
- package/dist/cjs/error-parser/parse-axios-error.js +1 -8
- package/dist/cjs/error-parser/parse-axios-error.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/Lookup.js +40 -114
- package/dist/esm/Lookup.js.map +1 -1
- package/dist/esm/__tests__/QnA.collections.spec.js +0 -11
- package/dist/esm/__tests__/QnA.collections.spec.js.map +1 -1
- package/dist/esm/error-parser/OrNetworkError.js +1 -5
- package/dist/esm/error-parser/OrNetworkError.js.map +1 -1
- package/dist/esm/error-parser/parse-axios-error.js +1 -8
- package/dist/esm/error-parser/parse-axios-error.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/types/Lookup.d.ts +21 -21
- package/dist/types/Lookup.d.ts.map +1 -1
- package/dist/types/error-parser/OrNetworkError.d.ts +1 -3
- package/dist/types/error-parser/OrNetworkError.d.ts.map +1 -1
- package/dist/types/error-parser/parse-axios-error.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/Lookup.ts +110 -28
- package/src/__tests__/QnA.collections.spec.ts +1 -15
- package/src/error-parser/OrNetworkError.ts +1 -7
- package/src/error-parser/parse-axios-error.ts +1 -8
- package/src/types.ts +4 -0
package/README.md
CHANGED
|
@@ -52,41 +52,39 @@ const lookup = new Lookup({
|
|
|
52
52
|
|
|
53
53
|
Once you have an instance of the `Lookup` client, you can use its methods to interact with the OneReach.ai Lookup system. The available methods are:
|
|
54
54
|
|
|
55
|
-
### `loadDocument`
|
|
56
|
-
|
|
57
|
-
Loads a document into a collection by providing a URL to the document. The document can be in PDF, CSV, or HTML format. The Lookup system downloads the content, splits it into smaller chunks called passages, and adds them to the collection. For CSV files, the primary data source is the `content` column, and additional columns can be matched to custom properties in the collection schema. The loading process is asynchronous, and the document status can be used to check if the loading is in progress or if an error occurred.
|
|
58
|
-
|
|
59
|
-
#### Params
|
|
60
|
-
- `collectionId`: `string` - The ID of the collection the document will be loaded into
|
|
61
|
-
- `params`: `LoadDocument` - Document loading parameters
|
|
62
|
-
- `description`: `string` (optional) - Document description
|
|
63
|
-
- `url`: `string` - The URL of the document to load
|
|
64
|
-
- `name`: `string` - Document name
|
|
65
|
-
- `defaultProperties`: `Record<string, unknown>` (optional) - Default custom properties for the document passages. Note that these properties should be listed in the collection properties.
|
|
66
|
-
|
|
67
|
-
#### Status
|
|
68
|
-
The `status` field is used to identify the document loading progress and possible errors. The possible status values are:
|
|
69
|
-
- `NEW` - The document has been created, but the loading process has not started yet.
|
|
70
|
-
- `LOADING` - The document loading is in progress.
|
|
71
|
-
- `READY` - The document loading has been completed successfully.
|
|
72
|
-
- `ERROR` - An error occurred during the document loading process due to unknown reasons.
|
|
73
|
-
- `string` - If a specific error occurred during the loading process, the error message will be provided in the status field.
|
|
74
|
-
|
|
75
55
|
#### Example
|
|
76
56
|
|
|
77
|
-
|
|
57
|
+
This example demonstrates how to abort the `loadDocument` request by providing an `AbortSignal`.
|
|
78
58
|
|
|
79
59
|
```typescript
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
60
|
+
const controller = new AbortController();
|
|
61
|
+
const signal = controller.signal;
|
|
62
|
+
|
|
63
|
+
setTimeout(() => controller.abort(), 5000);
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
const collectionId = 'a1b2c3d4-uuid';
|
|
67
|
+
const document = await lookup.loadDocument(collectionId, {
|
|
68
|
+
name: 'Sample Document',
|
|
69
|
+
description: 'A sample document',
|
|
70
|
+
url: 'http://example.com/sample-document.pdf',
|
|
71
|
+
defaultProperties: {
|
|
72
|
+
author: 'John Doe',
|
|
73
|
+
publishDate: '2020-12-31'
|
|
74
|
+
}
|
|
75
|
+
}, { signal });
|
|
76
|
+
} catch (err) {
|
|
77
|
+
if (err.name === 'AbortError') {
|
|
78
|
+
console.log('loadDocument request was aborted');
|
|
79
|
+
} else {
|
|
80
|
+
console.error(err);
|
|
88
81
|
}
|
|
89
|
-
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
In the above example, if the `loadDocument` call does not complete within 5 seconds, the `AbortController`'s `abort` method is called, which signals that the request should be aborted. The `loadDocument` call then throws an `AbortError`, which is caught and logged. This is useful for putting a time limit on requests that might otherwise hang indefinitely due to network issues.
|
|
86
|
+
|
|
87
|
+
**Note:** The abort signal is available for all the methods of the Lookup SDK.
|
|
90
88
|
|
|
91
89
|
// Example response
|
|
92
90
|
{
|
package/dist/cjs/Lookup.js
CHANGED
|
@@ -14,6 +14,17 @@ 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
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
29
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
30
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -71,16 +82,13 @@ var Lookup = (function (_super) {
|
|
|
71
82
|
Lookup.prototype.parseError = function (err) {
|
|
72
83
|
return errorParser(err);
|
|
73
84
|
};
|
|
74
|
-
Lookup.prototype.loadDocument = function (collectionId, params) {
|
|
85
|
+
Lookup.prototype.loadDocument = function (collectionId, params, options) {
|
|
86
|
+
if (options === void 0) { options = {}; }
|
|
75
87
|
return __awaiter(this, void 0, void 0, function () {
|
|
76
88
|
var response;
|
|
77
89
|
return __generator(this, function (_a) {
|
|
78
90
|
switch (_a.label) {
|
|
79
|
-
case 0: return [4, this.callApiV2({
|
|
80
|
-
method: 'POST',
|
|
81
|
-
route: "collections/".concat(collectionId, "/documents"),
|
|
82
|
-
data: params,
|
|
83
|
-
})];
|
|
91
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'POST', route: "collections/".concat(collectionId, "/documents"), data: params }, options))];
|
|
84
92
|
case 1:
|
|
85
93
|
response = _a.sent();
|
|
86
94
|
return [2, response];
|
|
@@ -88,16 +96,13 @@ var Lookup = (function (_super) {
|
|
|
88
96
|
});
|
|
89
97
|
});
|
|
90
98
|
};
|
|
91
|
-
Lookup.prototype.createCollection = function (params) {
|
|
99
|
+
Lookup.prototype.createCollection = function (params, options) {
|
|
100
|
+
if (options === void 0) { options = {}; }
|
|
92
101
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
102
|
var response;
|
|
94
103
|
return __generator(this, function (_a) {
|
|
95
104
|
switch (_a.label) {
|
|
96
|
-
case 0: return [4, this.callApiV2({
|
|
97
|
-
method: 'POST',
|
|
98
|
-
route: 'collections',
|
|
99
|
-
data: params,
|
|
100
|
-
})];
|
|
105
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'POST', route: 'collections', data: params }, options))];
|
|
101
106
|
case 1:
|
|
102
107
|
response = _a.sent();
|
|
103
108
|
return [2, response];
|
|
@@ -105,16 +110,13 @@ var Lookup = (function (_super) {
|
|
|
105
110
|
});
|
|
106
111
|
});
|
|
107
112
|
};
|
|
108
|
-
Lookup.prototype.createPassage = function (collectionId, passage) {
|
|
113
|
+
Lookup.prototype.createPassage = function (collectionId, passage, options) {
|
|
114
|
+
if (options === void 0) { options = {}; }
|
|
109
115
|
return __awaiter(this, void 0, void 0, function () {
|
|
110
116
|
var response;
|
|
111
117
|
return __generator(this, function (_a) {
|
|
112
118
|
switch (_a.label) {
|
|
113
|
-
case 0: return [4, this.callApiV2({
|
|
114
|
-
method: 'POST',
|
|
115
|
-
route: "collections/".concat(collectionId, "/passages"),
|
|
116
|
-
data: passage,
|
|
117
|
-
})];
|
|
119
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'POST', route: "collections/".concat(collectionId, "/passages"), data: passage }, options))];
|
|
118
120
|
case 1:
|
|
119
121
|
response = _a.sent();
|
|
120
122
|
return [2, response];
|
|
@@ -122,15 +124,12 @@ var Lookup = (function (_super) {
|
|
|
122
124
|
});
|
|
123
125
|
});
|
|
124
126
|
};
|
|
125
|
-
Lookup.prototype.createManyPassages = function (collectionId, passages) {
|
|
127
|
+
Lookup.prototype.createManyPassages = function (collectionId, passages, options) {
|
|
128
|
+
if (options === void 0) { options = {}; }
|
|
126
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
127
130
|
return __generator(this, function (_a) {
|
|
128
131
|
switch (_a.label) {
|
|
129
|
-
case 0: return [4, this.callApiV2({
|
|
130
|
-
method: 'POST',
|
|
131
|
-
route: "collections/".concat(collectionId, "/passages/batch"),
|
|
132
|
-
data: passages,
|
|
133
|
-
})];
|
|
132
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'POST', route: "collections/".concat(collectionId, "/passages/batch"), data: passages }, options))];
|
|
134
133
|
case 1:
|
|
135
134
|
_a.sent();
|
|
136
135
|
return [2];
|
|
@@ -138,15 +137,13 @@ var Lookup = (function (_super) {
|
|
|
138
137
|
});
|
|
139
138
|
});
|
|
140
139
|
};
|
|
141
|
-
Lookup.prototype.deleteCollection = function (collectionId) {
|
|
140
|
+
Lookup.prototype.deleteCollection = function (collectionId, options) {
|
|
141
|
+
if (options === void 0) { options = {}; }
|
|
142
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
143
143
|
var response;
|
|
144
144
|
return __generator(this, function (_a) {
|
|
145
145
|
switch (_a.label) {
|
|
146
|
-
case 0: return [4, this.callApiV2({
|
|
147
|
-
method: 'DELETE',
|
|
148
|
-
route: "collections/".concat(collectionId),
|
|
149
|
-
})];
|
|
146
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'DELETE', route: "collections/".concat(collectionId) }, options))];
|
|
150
147
|
case 1:
|
|
151
148
|
response = _a.sent();
|
|
152
149
|
return [2, response];
|
|
@@ -154,15 +151,13 @@ var Lookup = (function (_super) {
|
|
|
154
151
|
});
|
|
155
152
|
});
|
|
156
153
|
};
|
|
157
|
-
Lookup.prototype.deletePassage = function (collectionId, passageId) {
|
|
154
|
+
Lookup.prototype.deletePassage = function (collectionId, passageId, options) {
|
|
155
|
+
if (options === void 0) { options = {}; }
|
|
158
156
|
return __awaiter(this, void 0, void 0, function () {
|
|
159
157
|
var response;
|
|
160
158
|
return __generator(this, function (_a) {
|
|
161
159
|
switch (_a.label) {
|
|
162
|
-
case 0: return [4, this.callApiV2({
|
|
163
|
-
method: 'DELETE',
|
|
164
|
-
route: "collections/".concat(collectionId, "/passages/").concat(passageId),
|
|
165
|
-
})];
|
|
160
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'DELETE', route: "collections/".concat(collectionId, "/passages/").concat(passageId) }, options))];
|
|
166
161
|
case 1:
|
|
167
162
|
response = _a.sent();
|
|
168
163
|
return [2, response];
|
|
@@ -170,16 +165,13 @@ var Lookup = (function (_super) {
|
|
|
170
165
|
});
|
|
171
166
|
});
|
|
172
167
|
};
|
|
173
|
-
Lookup.prototype.search = function (collectionId, params) {
|
|
168
|
+
Lookup.prototype.search = function (collectionId, params, options) {
|
|
169
|
+
if (options === void 0) { options = {}; }
|
|
174
170
|
return __awaiter(this, void 0, void 0, function () {
|
|
175
171
|
var response;
|
|
176
172
|
return __generator(this, function (_a) {
|
|
177
173
|
switch (_a.label) {
|
|
178
|
-
case 0: return [4, this.callApiV2({
|
|
179
|
-
method: 'POST',
|
|
180
|
-
route: "collections/".concat(collectionId, "/search"),
|
|
181
|
-
data: params,
|
|
182
|
-
})];
|
|
174
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'POST', route: "collections/".concat(collectionId, "/search"), data: params }, options))];
|
|
183
175
|
case 1:
|
|
184
176
|
response = _a.sent();
|
|
185
177
|
return [2, response];
|
|
@@ -187,16 +179,13 @@ var Lookup = (function (_super) {
|
|
|
187
179
|
});
|
|
188
180
|
});
|
|
189
181
|
};
|
|
190
|
-
Lookup.prototype.ask = function (collectionId, params) {
|
|
182
|
+
Lookup.prototype.ask = function (collectionId, params, options) {
|
|
183
|
+
if (options === void 0) { options = {}; }
|
|
191
184
|
return __awaiter(this, void 0, void 0, function () {
|
|
192
185
|
var response;
|
|
193
186
|
return __generator(this, function (_a) {
|
|
194
187
|
switch (_a.label) {
|
|
195
|
-
case 0: return [4, this.callApiV2({
|
|
196
|
-
method: 'POST',
|
|
197
|
-
route: "collections/".concat(collectionId, "/ask"),
|
|
198
|
-
data: params,
|
|
199
|
-
})];
|
|
188
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'POST', route: "collections/".concat(collectionId, "/ask"), data: params }, options))];
|
|
200
189
|
case 1:
|
|
201
190
|
response = _a.sent();
|
|
202
191
|
return [2, response];
|
|
@@ -204,16 +193,13 @@ var Lookup = (function (_super) {
|
|
|
204
193
|
});
|
|
205
194
|
});
|
|
206
195
|
};
|
|
207
|
-
Lookup.prototype.updateDocument = function (collectionId, documentId, params) {
|
|
196
|
+
Lookup.prototype.updateDocument = function (collectionId, documentId, params, options) {
|
|
197
|
+
if (options === void 0) { options = {}; }
|
|
208
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
209
199
|
var response;
|
|
210
200
|
return __generator(this, function (_a) {
|
|
211
201
|
switch (_a.label) {
|
|
212
|
-
case 0: return [4, this.callApiV2({
|
|
213
|
-
method: 'PUT',
|
|
214
|
-
route: "collections/".concat(collectionId, "/documents/").concat(documentId),
|
|
215
|
-
data: params,
|
|
216
|
-
})];
|
|
202
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'PUT', route: "collections/".concat(collectionId, "/documents/").concat(documentId), data: params }, options))];
|
|
217
203
|
case 1:
|
|
218
204
|
response = _a.sent();
|
|
219
205
|
return [2, response];
|
|
@@ -221,16 +207,13 @@ var Lookup = (function (_super) {
|
|
|
221
207
|
});
|
|
222
208
|
});
|
|
223
209
|
};
|
|
224
|
-
Lookup.prototype.updatePassage = function (collectionId, passageId, params) {
|
|
210
|
+
Lookup.prototype.updatePassage = function (collectionId, passageId, params, options) {
|
|
211
|
+
if (options === void 0) { options = {}; }
|
|
225
212
|
return __awaiter(this, void 0, void 0, function () {
|
|
226
213
|
var response;
|
|
227
214
|
return __generator(this, function (_a) {
|
|
228
215
|
switch (_a.label) {
|
|
229
|
-
case 0: return [4, this.callApiV2({
|
|
230
|
-
method: 'PUT',
|
|
231
|
-
route: "collections/".concat(collectionId, "/passages/").concat(passageId),
|
|
232
|
-
data: params,
|
|
233
|
-
})];
|
|
216
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'PUT', route: "collections/".concat(collectionId, "/passages/").concat(passageId), data: params }, options))];
|
|
234
217
|
case 1:
|
|
235
218
|
response = _a.sent();
|
|
236
219
|
return [2, response];
|
|
@@ -238,16 +221,13 @@ var Lookup = (function (_super) {
|
|
|
238
221
|
});
|
|
239
222
|
});
|
|
240
223
|
};
|
|
241
|
-
Lookup.prototype.updateCollection = function (collectionId, params) {
|
|
224
|
+
Lookup.prototype.updateCollection = function (collectionId, params, options) {
|
|
225
|
+
if (options === void 0) { options = {}; }
|
|
242
226
|
return __awaiter(this, void 0, void 0, function () {
|
|
243
227
|
var response;
|
|
244
228
|
return __generator(this, function (_a) {
|
|
245
229
|
switch (_a.label) {
|
|
246
|
-
case 0: return [4, this.callApiV2({
|
|
247
|
-
method: 'PUT',
|
|
248
|
-
route: "collections/".concat(collectionId),
|
|
249
|
-
data: params,
|
|
250
|
-
})];
|
|
230
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'PUT', route: "collections/".concat(collectionId), data: params }, options))];
|
|
251
231
|
case 1:
|
|
252
232
|
response = _a.sent();
|
|
253
233
|
return [2, response];
|
|
@@ -255,15 +235,13 @@ var Lookup = (function (_super) {
|
|
|
255
235
|
});
|
|
256
236
|
});
|
|
257
237
|
};
|
|
258
|
-
Lookup.prototype.getDocument = function (collectionId, documentId) {
|
|
238
|
+
Lookup.prototype.getDocument = function (collectionId, documentId, options) {
|
|
239
|
+
if (options === void 0) { options = {}; }
|
|
259
240
|
return __awaiter(this, void 0, void 0, function () {
|
|
260
241
|
var response;
|
|
261
242
|
return __generator(this, function (_a) {
|
|
262
243
|
switch (_a.label) {
|
|
263
|
-
case 0: return [4, this.callApiV2({
|
|
264
|
-
method: 'GET',
|
|
265
|
-
route: "collections/".concat(collectionId, "/documents/").concat(documentId),
|
|
266
|
-
})];
|
|
244
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'GET', route: "collections/".concat(collectionId, "/documents/").concat(documentId) }, options))];
|
|
267
245
|
case 1:
|
|
268
246
|
response = _a.sent();
|
|
269
247
|
return [2, response];
|
|
@@ -271,15 +249,13 @@ var Lookup = (function (_super) {
|
|
|
271
249
|
});
|
|
272
250
|
});
|
|
273
251
|
};
|
|
274
|
-
Lookup.prototype.getCollection = function (collectionId) {
|
|
252
|
+
Lookup.prototype.getCollection = function (collectionId, options) {
|
|
253
|
+
if (options === void 0) { options = {}; }
|
|
275
254
|
return __awaiter(this, void 0, void 0, function () {
|
|
276
255
|
var response;
|
|
277
256
|
return __generator(this, function (_a) {
|
|
278
257
|
switch (_a.label) {
|
|
279
|
-
case 0: return [4, this.callApiV2({
|
|
280
|
-
method: 'GET',
|
|
281
|
-
route: "collections/".concat(collectionId),
|
|
282
|
-
})];
|
|
258
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'GET', route: "collections/".concat(collectionId) }, options))];
|
|
283
259
|
case 1:
|
|
284
260
|
response = _a.sent();
|
|
285
261
|
return [2, response];
|
|
@@ -287,15 +263,13 @@ var Lookup = (function (_super) {
|
|
|
287
263
|
});
|
|
288
264
|
});
|
|
289
265
|
};
|
|
290
|
-
Lookup.prototype.getPassage = function (collectionId, passageId) {
|
|
266
|
+
Lookup.prototype.getPassage = function (collectionId, passageId, options) {
|
|
267
|
+
if (options === void 0) { options = {}; }
|
|
291
268
|
return __awaiter(this, void 0, void 0, function () {
|
|
292
269
|
var response;
|
|
293
270
|
return __generator(this, function (_a) {
|
|
294
271
|
switch (_a.label) {
|
|
295
|
-
case 0: return [4, this.callApiV2({
|
|
296
|
-
method: 'GET',
|
|
297
|
-
route: "collections/".concat(collectionId, "/passages/").concat(passageId),
|
|
298
|
-
})];
|
|
272
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'GET', route: "collections/".concat(collectionId, "/passages/").concat(passageId) }, options))];
|
|
299
273
|
case 1:
|
|
300
274
|
response = _a.sent();
|
|
301
275
|
return [2, response];
|
|
@@ -303,15 +277,12 @@ var Lookup = (function (_super) {
|
|
|
303
277
|
});
|
|
304
278
|
});
|
|
305
279
|
};
|
|
306
|
-
Lookup.prototype.addProperty = function (collectionId, property) {
|
|
280
|
+
Lookup.prototype.addProperty = function (collectionId, property, options) {
|
|
281
|
+
if (options === void 0) { options = {}; }
|
|
307
282
|
return __awaiter(this, void 0, void 0, function () {
|
|
308
283
|
return __generator(this, function (_a) {
|
|
309
284
|
switch (_a.label) {
|
|
310
|
-
case 0: return [4, this.callApiV2({
|
|
311
|
-
method: 'POST',
|
|
312
|
-
route: "collections/".concat(collectionId, "/properties"),
|
|
313
|
-
data: property,
|
|
314
|
-
})];
|
|
285
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'POST', route: "collections/".concat(collectionId, "/properties"), data: property }, options))];
|
|
315
286
|
case 1:
|
|
316
287
|
_a.sent();
|
|
317
288
|
return [2];
|
|
@@ -319,17 +290,14 @@ var Lookup = (function (_super) {
|
|
|
319
290
|
});
|
|
320
291
|
});
|
|
321
292
|
};
|
|
322
|
-
Lookup.prototype.listDocuments = function (collectionId, params) {
|
|
293
|
+
Lookup.prototype.listDocuments = function (collectionId, params, options) {
|
|
323
294
|
if (params === void 0) { params = {}; }
|
|
295
|
+
if (options === void 0) { options = {}; }
|
|
324
296
|
return __awaiter(this, void 0, void 0, function () {
|
|
325
297
|
var response;
|
|
326
298
|
return __generator(this, function (_a) {
|
|
327
299
|
switch (_a.label) {
|
|
328
|
-
case 0: return [4, this.callApiV2({
|
|
329
|
-
method: 'GET',
|
|
330
|
-
route: "collections/".concat(collectionId, "/documents"),
|
|
331
|
-
params: params,
|
|
332
|
-
})];
|
|
300
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'GET', route: "collections/".concat(collectionId, "/documents"), params: params }, options))];
|
|
333
301
|
case 1:
|
|
334
302
|
response = _a.sent();
|
|
335
303
|
return [2, (0, base_1.makeList)(response)];
|
|
@@ -337,17 +305,14 @@ var Lookup = (function (_super) {
|
|
|
337
305
|
});
|
|
338
306
|
});
|
|
339
307
|
};
|
|
340
|
-
Lookup.prototype.listCollections = function (params) {
|
|
308
|
+
Lookup.prototype.listCollections = function (params, options) {
|
|
341
309
|
if (params === void 0) { params = {}; }
|
|
310
|
+
if (options === void 0) { options = {}; }
|
|
342
311
|
return __awaiter(this, void 0, void 0, function () {
|
|
343
312
|
var response;
|
|
344
313
|
return __generator(this, function (_a) {
|
|
345
314
|
switch (_a.label) {
|
|
346
|
-
case 0: return [4, this.callApiV2({
|
|
347
|
-
method: 'GET',
|
|
348
|
-
route: 'collections',
|
|
349
|
-
params: params,
|
|
350
|
-
})];
|
|
315
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'GET', route: 'collections', params: params }, options))];
|
|
351
316
|
case 1:
|
|
352
317
|
response = _a.sent();
|
|
353
318
|
return [2, (0, base_1.makeList)(response)];
|
|
@@ -355,17 +320,14 @@ var Lookup = (function (_super) {
|
|
|
355
320
|
});
|
|
356
321
|
});
|
|
357
322
|
};
|
|
358
|
-
Lookup.prototype.listPassages = function (collectionId, params) {
|
|
323
|
+
Lookup.prototype.listPassages = function (collectionId, params, options) {
|
|
359
324
|
if (params === void 0) { params = {}; }
|
|
325
|
+
if (options === void 0) { options = {}; }
|
|
360
326
|
return __awaiter(this, void 0, void 0, function () {
|
|
361
327
|
var response;
|
|
362
328
|
return __generator(this, function (_a) {
|
|
363
329
|
switch (_a.label) {
|
|
364
|
-
case 0: return [4, this.callApiV2({
|
|
365
|
-
method: 'GET',
|
|
366
|
-
route: "collections/".concat(collectionId, "/passages"),
|
|
367
|
-
params: params,
|
|
368
|
-
})];
|
|
330
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'GET', route: "collections/".concat(collectionId, "/passages"), params: params }, options))];
|
|
369
331
|
case 1:
|
|
370
332
|
response = _a.sent();
|
|
371
333
|
return [2, (0, base_1.makeList)(response)];
|
|
@@ -373,17 +335,14 @@ var Lookup = (function (_super) {
|
|
|
373
335
|
});
|
|
374
336
|
});
|
|
375
337
|
};
|
|
376
|
-
Lookup.prototype.listPassagesInDocument = function (collectionId, documentId, find) {
|
|
338
|
+
Lookup.prototype.listPassagesInDocument = function (collectionId, documentId, find, options) {
|
|
377
339
|
if (find === void 0) { find = {}; }
|
|
340
|
+
if (options === void 0) { options = {}; }
|
|
378
341
|
return __awaiter(this, void 0, void 0, function () {
|
|
379
342
|
var response;
|
|
380
343
|
return __generator(this, function (_a) {
|
|
381
344
|
switch (_a.label) {
|
|
382
|
-
case 0: return [4, this.callApiV2({
|
|
383
|
-
method: 'GET',
|
|
384
|
-
route: "collections/".concat(collectionId, "/documents/").concat(documentId, "/passages"),
|
|
385
|
-
params: find,
|
|
386
|
-
})];
|
|
345
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'GET', route: "collections/".concat(collectionId, "/documents/").concat(documentId, "/passages"), params: find }, options))];
|
|
387
346
|
case 1:
|
|
388
347
|
response = _a.sent();
|
|
389
348
|
return [2, (0, base_1.makeList)(response)];
|
|
@@ -391,15 +350,13 @@ var Lookup = (function (_super) {
|
|
|
391
350
|
});
|
|
392
351
|
});
|
|
393
352
|
};
|
|
394
|
-
Lookup.prototype.deleteDocument = function (collectionId, documentId) {
|
|
353
|
+
Lookup.prototype.deleteDocument = function (collectionId, documentId, options) {
|
|
354
|
+
if (options === void 0) { options = {}; }
|
|
395
355
|
return __awaiter(this, void 0, void 0, function () {
|
|
396
356
|
var response;
|
|
397
357
|
return __generator(this, function (_a) {
|
|
398
358
|
switch (_a.label) {
|
|
399
|
-
case 0: return [4, this.callApiV2({
|
|
400
|
-
method: 'DELETE',
|
|
401
|
-
route: "collections/".concat(collectionId, "/documents/").concat(documentId),
|
|
402
|
-
})];
|
|
359
|
+
case 0: return [4, this.callApiV2(__assign({ method: 'DELETE', route: "collections/".concat(collectionId, "/documents/").concat(documentId) }, options))];
|
|
403
360
|
case 1:
|
|
404
361
|
response = _a.sent();
|
|
405
362
|
return [2, response];
|
package/dist/cjs/Lookup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lookup.js","sourceRoot":"","sources":["../../src/Lookup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Lookup.js","sourceRoot":"","sources":["../../src/Lookup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoD;AACpD,yCAA0C;AAO1C,+CAA+D;AAE/D,IAAM,WAAW,GAAG,IAAA,gCAAiB,EAAC,yBAAU,CAAC,KAAK,CAAC,CAAC;AAExD;IAA4B,0BAAI;IAC9B,gBAAY,MAAoB;QACtB,IAAA,KAAK,GAA0C,MAAM,MAA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;wBAEF,WAAO,QAAQ,EAAC;;;;KACjB;IACH,aAAC;AAAD,CAAC,AAtaD,CAA4B,WAAI,GAsa/B;AAtaY,wBAAM"}
|
|
@@ -153,25 +153,5 @@ var createLookupInstance = function (opts) {
|
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
}); });
|
|
156
|
-
(0, vitest_1.it)('should show ISE properly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
-
var lookup, promise;
|
|
158
|
-
return __generator(this, function (_a) {
|
|
159
|
-
switch (_a.label) {
|
|
160
|
-
case 0:
|
|
161
|
-
lookup = createLookupInstance();
|
|
162
|
-
promise = lookup.createCollection({
|
|
163
|
-
ise: true,
|
|
164
|
-
});
|
|
165
|
-
return [4, (0, vitest_1.expect)(promise).rejects.toMatchObject({
|
|
166
|
-
status: 500,
|
|
167
|
-
message: 'Internal server error',
|
|
168
|
-
description: 'Some tech error message here',
|
|
169
|
-
})];
|
|
170
|
-
case 1:
|
|
171
|
-
_a.sent();
|
|
172
|
-
return [2];
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}); });
|
|
176
156
|
});
|
|
177
157
|
//# sourceMappingURL=QnA.collections.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QnA.collections.spec.js","sourceRoot":"","sources":["../../../src/__tests__/QnA.collections.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA8E;AAC9E,2BAA2B;AAC3B,iCAAuC;AAEvC,wBAA4B;AAG5B,+EAAoD;AAEpD,IAAM,MAAM,GAAG,IAAA,kBAAW,EACxB,UAAI,CAAC,IAAI,CAAC,4DAA4D,EAAE,UAAO,GAAG,EAAE,GAAG,EAAE,GAAG;;;;;gBAC1F,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,kBAAkB,EAAE;oBAC3D,WAAO,GAAG,CAA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,aAAa,CAAC;4BAC1C,MAAM,EAAE,GAAG;4BACX,OAAO,EAAE,qCAAqC;yBAC/C,CAAC,EAAA;;oBAHF,SAGE,CAAC;;;;SACJ,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,wCAAwC,EAAE;;;;;oBACrC,MAAM,GAAG,oBAAoB,EAAE,CAAC;oBAEhC,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;wBACtC,IAAI,EAAE,GAAG;qBACV,CAAC,CAAC;oBAEH,WAAM,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;4BAC1C,MAAM,EAAE,GAAG;4BACX,OAAO,EAAE,kFAAkF;yBAC5F,CAAC,EAAA;;oBAHF,SAGE,CAAC;;;;SACJ,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -19,10 +19,9 @@ exports.OrNetworkError = void 0;
|
|
|
19
19
|
var OrNetworkError = (function (_super) {
|
|
20
20
|
__extends(OrNetworkError, _super);
|
|
21
21
|
function OrNetworkError(_a) {
|
|
22
|
-
var
|
|
22
|
+
var message = _a.message, status = _a.status;
|
|
23
23
|
var _this = _super.call(this, message) || this;
|
|
24
24
|
_this._status = status;
|
|
25
|
-
_this._description = description;
|
|
26
25
|
return _this;
|
|
27
26
|
}
|
|
28
27
|
Object.defineProperty(OrNetworkError.prototype, "status", {
|
|
@@ -32,13 +31,6 @@ var OrNetworkError = (function (_super) {
|
|
|
32
31
|
enumerable: false,
|
|
33
32
|
configurable: true
|
|
34
33
|
});
|
|
35
|
-
Object.defineProperty(OrNetworkError.prototype, "description", {
|
|
36
|
-
get: function () {
|
|
37
|
-
return this._description;
|
|
38
|
-
},
|
|
39
|
-
enumerable: false,
|
|
40
|
-
configurable: true
|
|
41
|
-
});
|
|
42
34
|
return OrNetworkError;
|
|
43
35
|
}(Error));
|
|
44
36
|
exports.OrNetworkError = OrNetworkError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrNetworkError.js","sourceRoot":"","sources":["../../../src/error-parser/OrNetworkError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"OrNetworkError.js","sourceRoot":"","sources":["../../../src/error-parser/OrNetworkError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAKA;IAAoC,kCAAK;IAGvC,wBAAY,EAAgC;YAA9B,OAAO,aAAA,EAAE,MAAM,YAAA;QAA7B,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,OAAO,GAAG,MAAM,CAAC;;IACxB,CAAC;IAED,sBAAI,kCAAM;aAAV;YACE,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;;;OAAA;IACH,qBAAC;AAAD,CAAC,AAXD,CAAoC,KAAK,GAWxC;AAXY,wCAAc"}
|
|
@@ -12,16 +12,9 @@ function parseAxiosError(e) {
|
|
|
12
12
|
var status_1 = e.response.status;
|
|
13
13
|
var generalMessage = MESSAGES[status_1] || e.message;
|
|
14
14
|
var message = normalizeMessage(data.message || data.error) || generalMessage;
|
|
15
|
-
if (status_1 < 500) {
|
|
16
|
-
return new OrNetworkError_1.OrNetworkError({
|
|
17
|
-
message: message,
|
|
18
|
-
status: status_1,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
15
|
return new OrNetworkError_1.OrNetworkError({
|
|
22
|
-
message:
|
|
16
|
+
message: message,
|
|
23
17
|
status: status_1,
|
|
24
|
-
description: message,
|
|
25
18
|
});
|
|
26
19
|
}
|
|
27
20
|
return new Error(e.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-axios-error.js","sourceRoot":"","sources":["../../../src/error-parser/parse-axios-error.ts"],"names":[],"mappings":";;;AAEA,mDAAkD;AAElD,IAAM,QAAQ,GAA2B;IACvC,GAAG,EAAE,qCAAqC;IAC1C,GAAG,EAAE,uBAAuB;CAC7B,CAAC;AAEF,SAAgB,eAAe,CAAC,CAAa;IAC3C,IAA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,CAAC,OAAO,CAAC,EAAE;QAC1B,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC3B;AACH,CAAC"}
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AA6OA,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,qCAAmB,CAAA;IACnB,iCAAe,CAAA;IACf,iCAAe,CAAA;AACjB,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB"}
|