@azure/search-documents 11.3.1 → 11.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -41
- package/dist/index.js +786 -1021
- package/dist/index.js.map +1 -1
- package/dist-esm/src/constants.js +1 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/generated/data/index.js +1 -0
- package/dist-esm/src/generated/data/index.js.map +1 -1
- package/dist-esm/src/generated/data/models/index.js.map +1 -1
- package/dist-esm/src/generated/data/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/data/models/parameters.js +11 -21
- package/dist-esm/src/generated/data/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/data/operations/documents.js +21 -73
- package/dist-esm/src/generated/data/operations/documents.js.map +1 -1
- package/dist-esm/src/generated/data/operationsInterfaces/documents.js +9 -0
- package/dist-esm/src/generated/data/operationsInterfaces/documents.js.map +1 -0
- package/dist-esm/src/generated/data/operationsInterfaces/index.js +9 -0
- package/dist-esm/src/generated/data/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/generated/data/searchClient.js +2 -2
- package/dist-esm/src/generated/data/searchClient.js.map +1 -1
- package/dist-esm/src/generated/data/searchClientContext.js +7 -11
- package/dist-esm/src/generated/data/searchClientContext.js.map +1 -1
- package/dist-esm/src/generated/service/index.js +1 -0
- package/dist-esm/src/generated/service/index.js.map +1 -1
- package/dist-esm/src/generated/service/models/index.js.map +1 -1
- package/dist-esm/src/generated/service/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/service/models/parameters.js +0 -9
- package/dist-esm/src/generated/service/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/service/operations/dataSources.js +11 -37
- package/dist-esm/src/generated/service/operations/dataSources.js.map +1 -1
- package/dist-esm/src/generated/service/operations/indexers.js +17 -55
- package/dist-esm/src/generated/service/operations/indexers.js.map +1 -1
- package/dist-esm/src/generated/service/operations/indexes.js +15 -54
- package/dist-esm/src/generated/service/operations/indexes.js.map +1 -1
- package/dist-esm/src/generated/service/operations/skillsets.js +11 -37
- package/dist-esm/src/generated/service/operations/skillsets.js.map +1 -1
- package/dist-esm/src/generated/service/operations/synonymMaps.js +11 -37
- package/dist-esm/src/generated/service/operations/synonymMaps.js.map +1 -1
- package/dist-esm/src/generated/service/operationsInterfaces/dataSources.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/dataSources.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/index.js +13 -0
- package/dist-esm/src/generated/service/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/indexers.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/indexers.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/indexes.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/indexes.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/skillsets.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/skillsets.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/synonymMaps.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/synonymMaps.js.map +1 -0
- package/dist-esm/src/generated/service/searchServiceClient.js +10 -13
- package/dist-esm/src/generated/service/searchServiceClient.js.map +1 -1
- package/dist-esm/src/generated/service/searchServiceClientContext.js +7 -11
- package/dist-esm/src/generated/service/searchServiceClientContext.js.map +1 -1
- package/dist-esm/src/geographyPoint.js +1 -1
- package/dist-esm/src/geographyPoint.js.map +1 -1
- package/dist-esm/src/index.js +2 -2
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/indexDocumentsBatch.js +1 -1
- package/dist-esm/src/indexDocumentsBatch.js.map +1 -1
- package/dist-esm/src/indexModels.js.map +1 -1
- package/dist-esm/src/odataMetadataPolicy.js +7 -15
- package/dist-esm/src/odataMetadataPolicy.js.map +1 -1
- package/dist-esm/src/searchApiKeyCredentialPolicy.js +8 -21
- package/dist-esm/src/searchApiKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/src/searchAudience.js.map +1 -1
- package/dist-esm/src/searchClient.js +108 -126
- package/dist-esm/src/searchClient.js.map +1 -1
- package/dist-esm/src/searchIndexClient.js +112 -101
- package/dist-esm/src/searchIndexClient.js.map +1 -1
- package/dist-esm/src/searchIndexerClient.js +94 -106
- package/dist-esm/src/searchIndexerClient.js.map +1 -1
- package/dist-esm/src/searchIndexingBufferedSender.js +16 -17
- package/dist-esm/src/searchIndexingBufferedSender.js.map +1 -1
- package/dist-esm/src/serialization.js +6 -6
- package/dist-esm/src/serialization.js.map +1 -1
- package/dist-esm/src/serviceModels.js.map +1 -1
- package/dist-esm/src/serviceUtils.js +43 -61
- package/dist-esm/src/serviceUtils.js.map +1 -1
- package/dist-esm/src/synonymMapHelper.js +6 -2
- package/dist-esm/src/synonymMapHelper.js.map +1 -1
- package/dist-esm/src/tracing.js +6 -5
- package/dist-esm/src/tracing.js.map +1 -1
- package/package.json +53 -53
- package/types/search-documents.d.ts +137 -117
- package/CHANGELOG.md +0 -233
- package/dist-esm/src/generated/data/models/documentsMappers.js +0 -9
- package/dist-esm/src/generated/data/models/documentsMappers.js.map +0 -1
- package/dist-esm/src/generated/service/models/dataSourcesMappers.js +0 -9
- package/dist-esm/src/generated/service/models/dataSourcesMappers.js.map +0 -1
- package/dist-esm/src/generated/service/models/indexersMappers.js +0 -9
- package/dist-esm/src/generated/service/models/indexersMappers.js.map +0 -1
- package/dist-esm/src/generated/service/models/indexesMappers.js +0 -9
- package/dist-esm/src/generated/service/models/indexesMappers.js.map +0 -1
- package/dist-esm/src/generated/service/models/skillsetsMappers.js +0 -9
- package/dist-esm/src/generated/service/models/skillsetsMappers.js.map +0 -1
- package/dist-esm/src/generated/service/models/synonymMapsMappers.js +0 -9
- package/dist-esm/src/generated/service/models/synonymMapsMappers.js.map +0 -1
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
3
|
+
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __rest } from "tslib";
|
|
4
4
|
/// <reference lib="esnext.asynciterable" />
|
|
5
5
|
import { isTokenCredential } from "@azure/core-auth";
|
|
6
|
-
import {
|
|
7
|
-
import { SpanStatusCode } from "@azure/core-tracing";
|
|
8
|
-
import { SDK_VERSION } from "./constants";
|
|
6
|
+
import { bearerTokenAuthenticationPolicy, } from "@azure/core-rest-pipeline";
|
|
9
7
|
import { SearchServiceClient as GeneratedClient } from "./generated/service/searchServiceClient";
|
|
10
8
|
import { logger } from "./logger";
|
|
11
9
|
import { createSearchApiKeyCredentialPolicy } from "./searchApiKeyCredentialPolicy";
|
|
12
10
|
import * as utils from "./serviceUtils";
|
|
13
11
|
import { createSpan } from "./tracing";
|
|
14
|
-
import {
|
|
12
|
+
import { createOdataMetadataPolicy } from "./odataMetadataPolicy";
|
|
15
13
|
import { SearchClient } from "./searchClient";
|
|
16
14
|
import { KnownSearchAudience } from "./searchAudience";
|
|
15
|
+
import { SDK_VERSION } from "./constants";
|
|
17
16
|
/**
|
|
18
17
|
* Class to perform operations to manage
|
|
19
18
|
* (create, update, list/delete)
|
|
@@ -37,67 +36,56 @@ export class SearchIndexClient {
|
|
|
37
36
|
* @param options - Used to configure the Search Index client.
|
|
38
37
|
*/
|
|
39
38
|
constructor(endpoint, credential, options = {}) {
|
|
39
|
+
var _a, _b;
|
|
40
40
|
/**
|
|
41
41
|
* The API version to use when communicating with the service.
|
|
42
42
|
*/
|
|
43
|
-
this.apiVersion =
|
|
43
|
+
this.apiVersion = utils.defaultServiceVersion;
|
|
44
44
|
this.endpoint = endpoint;
|
|
45
45
|
this.credential = credential;
|
|
46
46
|
this.options = options;
|
|
47
47
|
const libInfo = `azsdk-js-search-documents/${SDK_VERSION}`;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
const userAgentOptions = Object.assign(Object.assign({}, this.options.userAgentOptions), { userAgentPrefix: ((_a = this.options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix)
|
|
49
|
+
? `${this.options.userAgentOptions.userAgentPrefix} ${libInfo}`
|
|
50
|
+
: libInfo });
|
|
51
|
+
const loggingOptions = {
|
|
52
|
+
logger: logger.info,
|
|
53
|
+
additionalAllowedHeaderNames: [
|
|
54
|
+
"elapsed-time",
|
|
55
|
+
"Location",
|
|
56
|
+
"OData-MaxVersion",
|
|
57
|
+
"OData-Version",
|
|
58
|
+
"Prefer",
|
|
59
|
+
"throttle-reason",
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
const internalClientPipelineOptions = Object.assign(Object.assign({}, this.options), { userAgentOptions,
|
|
63
|
+
loggingOptions });
|
|
64
|
+
this.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : utils.defaultServiceVersion;
|
|
65
|
+
this.client = new GeneratedClient(this.endpoint, this.apiVersion, internalClientPipelineOptions);
|
|
66
|
+
if (isTokenCredential(credential)) {
|
|
67
|
+
const scope = this.options.audience
|
|
68
|
+
? `${this.options.audience}/.default`
|
|
69
|
+
: `${KnownSearchAudience.AzurePublicCloud}/.default`;
|
|
70
|
+
this.client.pipeline.addPolicy(bearerTokenAuthenticationPolicy({ credential, scopes: scope }));
|
|
53
71
|
}
|
|
54
72
|
else {
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
const internalPipelineOptions = Object.assign(Object.assign({}, options), {
|
|
58
|
-
loggingOptions: {
|
|
59
|
-
logger: logger.info,
|
|
60
|
-
allowedHeaderNames: [
|
|
61
|
-
"elapsed-time",
|
|
62
|
-
"Location",
|
|
63
|
-
"OData-MaxVersion",
|
|
64
|
-
"OData-Version",
|
|
65
|
-
"Prefer",
|
|
66
|
-
"throttle-reason"
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
const scope = options.audience
|
|
71
|
-
? `${options.audience}/.default`
|
|
72
|
-
: `${KnownSearchAudience.AzurePublicCloud}/.default`;
|
|
73
|
-
const requestPolicyFactory = isTokenCredential(credential)
|
|
74
|
-
? bearerTokenAuthenticationPolicy(credential, scope)
|
|
75
|
-
: createSearchApiKeyCredentialPolicy(credential);
|
|
76
|
-
const pipeline = createPipelineFromOptions(internalPipelineOptions, requestPolicyFactory);
|
|
77
|
-
if (Array.isArray(pipeline.requestPolicyFactories)) {
|
|
78
|
-
pipeline.requestPolicyFactories.unshift(odataMetadataPolicy("minimal"));
|
|
79
|
-
}
|
|
80
|
-
let apiVersion = this.apiVersion;
|
|
81
|
-
if (options.apiVersion) {
|
|
82
|
-
if (!["2020-06-30-Preview", "2020-06-30"].includes(options.apiVersion)) {
|
|
83
|
-
throw new Error(`Invalid Api Version: ${options.apiVersion}`);
|
|
84
|
-
}
|
|
85
|
-
apiVersion = options.apiVersion;
|
|
73
|
+
this.client.pipeline.addPolicy(createSearchApiKeyCredentialPolicy(credential));
|
|
86
74
|
}
|
|
87
|
-
this.client
|
|
75
|
+
this.client.pipeline.addPolicy(createOdataMetadataPolicy("minimal"));
|
|
88
76
|
}
|
|
89
77
|
listIndexesPage(options = {}) {
|
|
90
78
|
return __asyncGenerator(this, arguments, function* listIndexesPage_1() {
|
|
91
79
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listIndexesPage", options);
|
|
92
80
|
try {
|
|
93
|
-
const result = yield __await(this.client.indexes.list(
|
|
81
|
+
const result = yield __await(this.client.indexes.list(updatedOptions));
|
|
94
82
|
const mapped = result.indexes.map(utils.generatedIndexToPublicIndex);
|
|
95
83
|
yield yield __await(mapped);
|
|
96
84
|
}
|
|
97
85
|
catch (e) {
|
|
98
86
|
span.setStatus({
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
status: "error",
|
|
88
|
+
error: e.message,
|
|
101
89
|
});
|
|
102
90
|
throw e;
|
|
103
91
|
}
|
|
@@ -108,17 +96,24 @@ export class SearchIndexClient {
|
|
|
108
96
|
}
|
|
109
97
|
listIndexesAll(options = {}) {
|
|
110
98
|
return __asyncGenerator(this, arguments, function* listIndexesAll_1() {
|
|
111
|
-
var e_1,
|
|
99
|
+
var _a, e_1, _b, _c;
|
|
112
100
|
try {
|
|
113
|
-
for (var
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
for (var _d = true, _e = __asyncValues(this.listIndexesPage(options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
102
|
+
_c = _f.value;
|
|
103
|
+
_d = false;
|
|
104
|
+
try {
|
|
105
|
+
const page = _c;
|
|
106
|
+
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
_d = true;
|
|
110
|
+
}
|
|
116
111
|
}
|
|
117
112
|
}
|
|
118
113
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
119
114
|
finally {
|
|
120
115
|
try {
|
|
121
|
-
if (
|
|
116
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
122
117
|
}
|
|
123
118
|
finally { if (e_1) throw e_1.error; }
|
|
124
119
|
}
|
|
@@ -139,21 +134,21 @@ export class SearchIndexClient {
|
|
|
139
134
|
},
|
|
140
135
|
byPage: () => {
|
|
141
136
|
return this.listIndexesPage(options);
|
|
142
|
-
}
|
|
137
|
+
},
|
|
143
138
|
};
|
|
144
139
|
}
|
|
145
140
|
listIndexesNamesPage(options = {}) {
|
|
146
141
|
return __asyncGenerator(this, arguments, function* listIndexesNamesPage_1() {
|
|
147
142
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listIndexesNamesPage", options);
|
|
148
143
|
try {
|
|
149
|
-
const result = yield __await(this.client.indexes.list(Object.assign(Object.assign({},
|
|
144
|
+
const result = yield __await(this.client.indexes.list(Object.assign(Object.assign({}, updatedOptions), { select: "name" })));
|
|
150
145
|
const mapped = result.indexes.map((idx) => idx.name);
|
|
151
146
|
yield yield __await(mapped);
|
|
152
147
|
}
|
|
153
148
|
catch (e) {
|
|
154
149
|
span.setStatus({
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
status: "error",
|
|
151
|
+
error: e.message,
|
|
157
152
|
});
|
|
158
153
|
throw e;
|
|
159
154
|
}
|
|
@@ -164,17 +159,24 @@ export class SearchIndexClient {
|
|
|
164
159
|
}
|
|
165
160
|
listIndexesNamesAll(options = {}) {
|
|
166
161
|
return __asyncGenerator(this, arguments, function* listIndexesNamesAll_1() {
|
|
167
|
-
var e_2,
|
|
162
|
+
var _a, e_2, _b, _c;
|
|
168
163
|
try {
|
|
169
|
-
for (var
|
|
170
|
-
|
|
171
|
-
|
|
164
|
+
for (var _d = true, _e = __asyncValues(this.listIndexesNamesPage(options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
|
|
165
|
+
_c = _f.value;
|
|
166
|
+
_d = false;
|
|
167
|
+
try {
|
|
168
|
+
const page = _c;
|
|
169
|
+
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
_d = true;
|
|
173
|
+
}
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
175
177
|
finally {
|
|
176
178
|
try {
|
|
177
|
-
if (
|
|
179
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
178
180
|
}
|
|
179
181
|
finally { if (e_2) throw e_2.error; }
|
|
180
182
|
}
|
|
@@ -195,7 +197,7 @@ export class SearchIndexClient {
|
|
|
195
197
|
},
|
|
196
198
|
byPage: () => {
|
|
197
199
|
return this.listIndexesNamesPage(options);
|
|
198
|
-
}
|
|
200
|
+
},
|
|
199
201
|
};
|
|
200
202
|
}
|
|
201
203
|
/**
|
|
@@ -205,13 +207,13 @@ export class SearchIndexClient {
|
|
|
205
207
|
async listSynonymMaps(options = {}) {
|
|
206
208
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listSynonymMaps", options);
|
|
207
209
|
try {
|
|
208
|
-
const result = await this.client.synonymMaps.list(
|
|
210
|
+
const result = await this.client.synonymMaps.list(updatedOptions);
|
|
209
211
|
return result.synonymMaps.map(utils.generatedSynonymMapToPublicSynonymMap);
|
|
210
212
|
}
|
|
211
213
|
catch (e) {
|
|
212
214
|
span.setStatus({
|
|
213
|
-
|
|
214
|
-
|
|
215
|
+
status: "error",
|
|
216
|
+
error: e.message,
|
|
215
217
|
});
|
|
216
218
|
throw e;
|
|
217
219
|
}
|
|
@@ -226,13 +228,13 @@ export class SearchIndexClient {
|
|
|
226
228
|
async listSynonymMapsNames(options = {}) {
|
|
227
229
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listSynonymMapsNames", options);
|
|
228
230
|
try {
|
|
229
|
-
const result = await this.client.synonymMaps.list(Object.assign(Object.assign({},
|
|
231
|
+
const result = await this.client.synonymMaps.list(Object.assign(Object.assign({}, updatedOptions), { select: "name" }));
|
|
230
232
|
return result.synonymMaps.map((sm) => sm.name);
|
|
231
233
|
}
|
|
232
234
|
catch (e) {
|
|
233
235
|
span.setStatus({
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
status: "error",
|
|
237
|
+
error: e.message,
|
|
236
238
|
});
|
|
237
239
|
throw e;
|
|
238
240
|
}
|
|
@@ -248,13 +250,13 @@ export class SearchIndexClient {
|
|
|
248
250
|
async getIndex(indexName, options = {}) {
|
|
249
251
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getIndex", options);
|
|
250
252
|
try {
|
|
251
|
-
const result = await this.client.indexes.get(indexName,
|
|
253
|
+
const result = await this.client.indexes.get(indexName, updatedOptions);
|
|
252
254
|
return utils.generatedIndexToPublicIndex(result);
|
|
253
255
|
}
|
|
254
256
|
catch (e) {
|
|
255
257
|
span.setStatus({
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
status: "error",
|
|
259
|
+
error: e.message,
|
|
258
260
|
});
|
|
259
261
|
throw e;
|
|
260
262
|
}
|
|
@@ -270,13 +272,13 @@ export class SearchIndexClient {
|
|
|
270
272
|
async getSynonymMap(synonymMapName, options = {}) {
|
|
271
273
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getSynonymMaps", options);
|
|
272
274
|
try {
|
|
273
|
-
const result = await this.client.synonymMaps.get(synonymMapName,
|
|
275
|
+
const result = await this.client.synonymMaps.get(synonymMapName, updatedOptions);
|
|
274
276
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
275
277
|
}
|
|
276
278
|
catch (e) {
|
|
277
279
|
span.setStatus({
|
|
278
|
-
|
|
279
|
-
|
|
280
|
+
status: "error",
|
|
281
|
+
error: e.message,
|
|
280
282
|
});
|
|
281
283
|
throw e;
|
|
282
284
|
}
|
|
@@ -292,13 +294,13 @@ export class SearchIndexClient {
|
|
|
292
294
|
async createIndex(index, options = {}) {
|
|
293
295
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createIndex", options);
|
|
294
296
|
try {
|
|
295
|
-
const result = await this.client.indexes.create(utils.publicIndexToGeneratedIndex(index),
|
|
297
|
+
const result = await this.client.indexes.create(utils.publicIndexToGeneratedIndex(index), updatedOptions);
|
|
296
298
|
return utils.generatedIndexToPublicIndex(result);
|
|
297
299
|
}
|
|
298
300
|
catch (e) {
|
|
299
301
|
span.setStatus({
|
|
300
|
-
|
|
301
|
-
|
|
302
|
+
status: "error",
|
|
303
|
+
error: e.message,
|
|
302
304
|
});
|
|
303
305
|
throw e;
|
|
304
306
|
}
|
|
@@ -314,13 +316,13 @@ export class SearchIndexClient {
|
|
|
314
316
|
async createSynonymMap(synonymMap, options = {}) {
|
|
315
317
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createSynonymMaps", options);
|
|
316
318
|
try {
|
|
317
|
-
const result = await this.client.synonymMaps.create(utils.publicSynonymMapToGeneratedSynonymMap(synonymMap),
|
|
319
|
+
const result = await this.client.synonymMaps.create(utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), updatedOptions);
|
|
318
320
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
319
321
|
}
|
|
320
322
|
catch (e) {
|
|
321
323
|
span.setStatus({
|
|
322
|
-
|
|
323
|
-
|
|
324
|
+
status: "error",
|
|
325
|
+
error: e.message,
|
|
324
326
|
});
|
|
325
327
|
throw e;
|
|
326
328
|
}
|
|
@@ -337,13 +339,13 @@ export class SearchIndexClient {
|
|
|
337
339
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createOrUpdateIndex", options);
|
|
338
340
|
try {
|
|
339
341
|
const etag = options.onlyIfUnchanged ? index.etag : undefined;
|
|
340
|
-
const result = await this.client.indexes.createOrUpdate(index.name, utils.publicIndexToGeneratedIndex(index), Object.assign(Object.assign({},
|
|
342
|
+
const result = await this.client.indexes.createOrUpdate(index.name, utils.publicIndexToGeneratedIndex(index), Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
341
343
|
return utils.generatedIndexToPublicIndex(result);
|
|
342
344
|
}
|
|
343
345
|
catch (e) {
|
|
344
346
|
span.setStatus({
|
|
345
|
-
|
|
346
|
-
|
|
347
|
+
status: "error",
|
|
348
|
+
error: e.message,
|
|
347
349
|
});
|
|
348
350
|
throw e;
|
|
349
351
|
}
|
|
@@ -360,13 +362,13 @@ export class SearchIndexClient {
|
|
|
360
362
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createOrUpdateSynonymMap", options);
|
|
361
363
|
try {
|
|
362
364
|
const etag = options.onlyIfUnchanged ? synonymMap.etag : undefined;
|
|
363
|
-
const result = await this.client.synonymMaps.createOrUpdate(synonymMap.name, utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), Object.assign(Object.assign({},
|
|
365
|
+
const result = await this.client.synonymMaps.createOrUpdate(synonymMap.name, utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
364
366
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
365
367
|
}
|
|
366
368
|
catch (e) {
|
|
367
369
|
span.setStatus({
|
|
368
|
-
|
|
369
|
-
|
|
370
|
+
status: "error",
|
|
371
|
+
error: e.message,
|
|
370
372
|
});
|
|
371
373
|
throw e;
|
|
372
374
|
}
|
|
@@ -384,12 +386,12 @@ export class SearchIndexClient {
|
|
|
384
386
|
try {
|
|
385
387
|
const indexName = typeof index === "string" ? index : index.name;
|
|
386
388
|
const etag = typeof index === "string" ? undefined : options.onlyIfUnchanged ? index.etag : undefined;
|
|
387
|
-
await this.client.indexes.delete(indexName, Object.assign(Object.assign({},
|
|
389
|
+
await this.client.indexes.delete(indexName, Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
388
390
|
}
|
|
389
391
|
catch (e) {
|
|
390
392
|
span.setStatus({
|
|
391
|
-
|
|
392
|
-
|
|
393
|
+
status: "error",
|
|
394
|
+
error: e.message,
|
|
393
395
|
});
|
|
394
396
|
throw e;
|
|
395
397
|
}
|
|
@@ -411,12 +413,12 @@ export class SearchIndexClient {
|
|
|
411
413
|
: options.onlyIfUnchanged
|
|
412
414
|
? synonymMap.etag
|
|
413
415
|
: undefined;
|
|
414
|
-
await this.client.synonymMaps.delete(synonymMapName, Object.assign(Object.assign({},
|
|
416
|
+
await this.client.synonymMaps.delete(synonymMapName, Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
415
417
|
}
|
|
416
418
|
catch (e) {
|
|
417
419
|
span.setStatus({
|
|
418
|
-
|
|
419
|
-
|
|
420
|
+
status: "error",
|
|
421
|
+
error: e.message,
|
|
420
422
|
});
|
|
421
423
|
throw e;
|
|
422
424
|
}
|
|
@@ -433,13 +435,13 @@ export class SearchIndexClient {
|
|
|
433
435
|
async getIndexStatistics(indexName, options = {}) {
|
|
434
436
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getIndexStatistics", options);
|
|
435
437
|
try {
|
|
436
|
-
const result = await this.client.indexes.getStatistics(indexName,
|
|
438
|
+
const result = await this.client.indexes.getStatistics(indexName, updatedOptions);
|
|
437
439
|
return result;
|
|
438
440
|
}
|
|
439
441
|
catch (e) {
|
|
440
442
|
span.setStatus({
|
|
441
|
-
|
|
442
|
-
|
|
443
|
+
status: "error",
|
|
444
|
+
error: e.message,
|
|
443
445
|
});
|
|
444
446
|
throw e;
|
|
445
447
|
}
|
|
@@ -454,16 +456,21 @@ export class SearchIndexClient {
|
|
|
454
456
|
* @param options - Additional arguments
|
|
455
457
|
*/
|
|
456
458
|
async analyzeText(indexName, options) {
|
|
457
|
-
const {
|
|
459
|
+
const { abortSignal, requestOptions, tracingOptions } = options, restOptions = __rest(options, ["abortSignal", "requestOptions", "tracingOptions"]);
|
|
460
|
+
const operationOptions = {
|
|
461
|
+
abortSignal,
|
|
462
|
+
requestOptions,
|
|
463
|
+
tracingOptions,
|
|
464
|
+
};
|
|
458
465
|
const { span, updatedOptions } = createSpan("SearchIndexClient-analyzeText", operationOptions);
|
|
459
466
|
try {
|
|
460
|
-
const result = await this.client.indexes.analyze(indexName, Object.assign(Object.assign({}, restOptions), { analyzer: restOptions.analyzerName, tokenizer: restOptions.tokenizerName }),
|
|
467
|
+
const result = await this.client.indexes.analyze(indexName, Object.assign(Object.assign({}, restOptions), { analyzer: restOptions.analyzerName, tokenizer: restOptions.tokenizerName }), updatedOptions);
|
|
461
468
|
return result;
|
|
462
469
|
}
|
|
463
470
|
catch (e) {
|
|
464
471
|
span.setStatus({
|
|
465
|
-
|
|
466
|
-
|
|
472
|
+
status: "error",
|
|
473
|
+
error: e.message,
|
|
467
474
|
});
|
|
468
475
|
throw e;
|
|
469
476
|
}
|
|
@@ -478,13 +485,13 @@ export class SearchIndexClient {
|
|
|
478
485
|
async getServiceStatistics(options = {}) {
|
|
479
486
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getServiceStatistics", options);
|
|
480
487
|
try {
|
|
481
|
-
const result = await this.client.getServiceStatistics(
|
|
488
|
+
const result = await this.client.getServiceStatistics(updatedOptions);
|
|
482
489
|
return result;
|
|
483
490
|
}
|
|
484
491
|
catch (e) {
|
|
485
492
|
span.setStatus({
|
|
486
|
-
|
|
487
|
-
|
|
493
|
+
status: "error",
|
|
494
|
+
error: e.message,
|
|
488
495
|
});
|
|
489
496
|
throw e;
|
|
490
497
|
}
|
|
@@ -496,6 +503,10 @@ export class SearchIndexClient {
|
|
|
496
503
|
* Retrieves the SearchClient corresponding to this SearchIndexClient
|
|
497
504
|
* @param indexName - Name of the index
|
|
498
505
|
* @param options - SearchClient Options
|
|
506
|
+
* @typeParam TModel - An optional type that represents the documents stored in
|
|
507
|
+
* the search index. For the best typing experience, all non-key fields should
|
|
508
|
+
* be marked optional and nullable, and the key property should have the
|
|
509
|
+
* non-nullable type `string`.
|
|
499
510
|
*/
|
|
500
511
|
getSearchClient(indexName, options) {
|
|
501
512
|
return new SearchClient(this.endpoint, indexName, this.credential, options || this.options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchIndexClient.js","sourceRoot":"","sources":["../../src/searchIndexClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,4CAA4C;AAE5C,OAAO,EAAkC,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EACL,yBAAyB,EAEzB,oCAAoC,EAGpC,+BAA+B,EAChC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,mBAAmB,IAAI,eAAe,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kCAAkC,EAAE,MAAM,gCAAgC,CAAC;AAsBpF,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YA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O,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IACjG,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport {\n createPipelineFromOptions,\n InternalPipelineOptions,\n operationOptionsToRequestOptionsBase,\n PipelineOptions,\n RequestPolicyFactory,\n bearerTokenAuthenticationPolicy\n} from \"@azure/core-http\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { SDK_VERSION } from \"./constants\";\nimport { AnalyzeResult } from \"./generated/service/models\";\nimport { SearchServiceClient as GeneratedClient } from \"./generated/service/searchServiceClient\";\nimport { logger } from \"./logger\";\nimport { createSearchApiKeyCredentialPolicy } from \"./searchApiKeyCredentialPolicy\";\nimport {\n AnalyzeTextOptions,\n CreateIndexOptions,\n CreateOrUpdateIndexOptions,\n CreateOrUpdateSynonymMapOptions,\n CreateSynonymMapOptions,\n DeleteIndexOptions,\n DeleteSynonymMapOptions,\n GetIndexOptions,\n GetIndexStatisticsOptions,\n GetSynonymMapsOptions,\n SearchIndex,\n ListIndexesOptions,\n ListSynonymMapsOptions,\n SynonymMap,\n GetServiceStatisticsOptions,\n IndexIterator,\n IndexNameIterator,\n SearchIndexStatistics,\n SearchServiceStatistics\n} from \"./serviceModels\";\nimport * as utils from \"./serviceUtils\";\nimport { createSpan } from \"./tracing\";\nimport { odataMetadataPolicy } from \"./odataMetadataPolicy\";\nimport { SearchClient, SearchClientOptions as GetSearchClientOptions } from \"./searchClient\";\nimport { KnownSearchAudience } from \"./searchAudience\";\n\n/**\n * Client options used to configure Cognitive Search API requests.\n */\nexport interface SearchIndexClientOptions extends PipelineOptions {\n /**\n * The API version to use when communicating with the service.\n */\n apiVersion?: string;\n\n /**\n * The Audience to use for authentication with Azure Active Directory (AAD). The\n * audience is not considered when using a shared key.\n * {@link KnownSearchAudience} can be used interchangeably with audience\n */\n audience?: string;\n}\n\n/**\n * Class to perform operations to manage\n * (create, update, list/delete)\n * indexes, & synonymmaps.\n */\nexport class SearchIndexClient {\n /**\n * The API version to use when communicating with the service.\n */\n public readonly apiVersion: string = \"2020-06-30\";\n\n /**\n * The endpoint of the search service\n */\n public readonly endpoint: string;\n\n /**\n * @internal\n * @hidden\n * A reference to the auto-generated SearchServiceClient\n */\n private readonly client: GeneratedClient;\n\n /**\n * Used to authenticate requests to the service.\n */\n private readonly credential: KeyCredential | TokenCredential;\n\n /**\n * Used to configure the Search Index client.\n */\n private readonly options: SearchIndexClientOptions;\n\n /**\n * Creates an instance of SearchIndexClient.\n *\n * Example usage:\n * ```ts\n * const { SearchIndexClient, AzureKeyCredential } = require(\"@azure/search-documents\");\n *\n * const client = new SearchIndexClient(\n * \"<endpoint>\",\n * new AzureKeyCredential(\"<Admin Key>\");\n * );\n * ```\n * @param endpoint - The endpoint of the search service\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Search Index client.\n */\n constructor(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options: SearchIndexClientOptions = {}\n ) {\n this.endpoint = endpoint;\n this.credential = credential;\n this.options = options;\n\n const libInfo = `azsdk-js-search-documents/${SDK_VERSION}`;\n if (!options.userAgentOptions) {\n options.userAgentOptions = {};\n }\n if (options.userAgentOptions.userAgentPrefix) {\n options.userAgentOptions.userAgentPrefix = `${options.userAgentOptions.userAgentPrefix} ${libInfo}`;\n } else {\n options.userAgentOptions.userAgentPrefix = libInfo;\n }\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\n \"elapsed-time\",\n \"Location\",\n \"OData-MaxVersion\",\n \"OData-Version\",\n \"Prefer\",\n \"throttle-reason\"\n ]\n }\n }\n };\n\n const scope: string = options.audience\n ? `${options.audience}/.default`\n : `${KnownSearchAudience.AzurePublicCloud}/.default`;\n\n const requestPolicyFactory: RequestPolicyFactory = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy(credential, scope)\n : createSearchApiKeyCredentialPolicy(credential);\n\n const pipeline = createPipelineFromOptions(internalPipelineOptions, requestPolicyFactory);\n\n if (Array.isArray(pipeline.requestPolicyFactories)) {\n pipeline.requestPolicyFactories.unshift(odataMetadataPolicy(\"minimal\"));\n }\n\n let apiVersion = this.apiVersion;\n\n if (options.apiVersion) {\n if (![\"2020-06-30-Preview\", \"2020-06-30\"].includes(options.apiVersion)) {\n throw new Error(`Invalid Api Version: ${options.apiVersion}`);\n }\n apiVersion = options.apiVersion;\n }\n\n this.client = new GeneratedClient(this.endpoint, apiVersion, pipeline);\n }\n\n private async *listIndexesPage(\n options: ListIndexesOptions = {}\n ): AsyncIterableIterator<SearchIndex[]> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-listIndexesPage\", options);\n try {\n const result = await this.client.indexes.list(\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n const mapped = result.indexes.map(utils.generatedIndexToPublicIndex);\n yield mapped;\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n private async *listIndexesAll(\n options: ListIndexesOptions = {}\n ): AsyncIterableIterator<SearchIndex> {\n for await (const page of this.listIndexesPage(options)) {\n yield* page;\n }\n }\n\n /**\n * Retrieves a list of existing indexes in the service.\n * @param options - Options to the list index operation.\n */\n public listIndexes(options: ListIndexesOptions = {}): IndexIterator {\n const iter = this.listIndexesAll(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listIndexesPage(options);\n }\n };\n }\n\n private async *listIndexesNamesPage(\n options: ListIndexesOptions = {}\n ): AsyncIterableIterator<string[]> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-listIndexesNamesPage\", options);\n try {\n const result = await this.client.indexes.list({\n ...operationOptionsToRequestOptionsBase(updatedOptions),\n select: \"name\"\n });\n const mapped = result.indexes.map((idx) => idx.name);\n yield mapped;\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n private async *listIndexesNamesAll(\n options: ListIndexesOptions = {}\n ): AsyncIterableIterator<string> {\n for await (const page of this.listIndexesNamesPage(options)) {\n yield* page;\n }\n }\n\n /**\n * Retrieves a list of names of existing indexes in the service.\n * @param options - Options to the list index operation.\n */\n public listIndexesNames(options: ListIndexesOptions = {}): IndexNameIterator {\n const iter = this.listIndexesNamesAll(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listIndexesNamesPage(options);\n }\n };\n }\n\n /**\n * Retrieves a list of existing SynonymMaps in the service.\n * @param options - Options to the list SynonymMaps operation.\n */\n public async listSynonymMaps(options: ListSynonymMapsOptions = {}): Promise<Array<SynonymMap>> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-listSynonymMaps\", options);\n try {\n const result = await this.client.synonymMaps.list(\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n return result.synonymMaps.map(utils.generatedSynonymMapToPublicSynonymMap);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves a list of names of existing SynonymMaps in the service.\n * @param options - Options to the list SynonymMaps operation.\n */\n public async listSynonymMapsNames(options: ListSynonymMapsOptions = {}): Promise<Array<string>> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-listSynonymMapsNames\", options);\n try {\n const result = await this.client.synonymMaps.list({\n ...operationOptionsToRequestOptionsBase(updatedOptions),\n select: \"name\"\n });\n return result.synonymMaps.map((sm) => sm.name);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves information about an index.\n * @param indexName - The name of the index.\n * @param options - Additional optional arguments.\n */\n public async getIndex(indexName: string, options: GetIndexOptions = {}): Promise<SearchIndex> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-getIndex\", options);\n try {\n const result = await this.client.indexes.get(\n indexName,\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n return utils.generatedIndexToPublicIndex(result);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves information about a SynonymMap.\n * @param synonymMapName - The name of the SynonymMap.\n * @param options - Additional optional arguments.\n */\n public async getSynonymMap(\n synonymMapName: string,\n options: GetSynonymMapsOptions = {}\n ): Promise<SynonymMap> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-getSynonymMaps\", options);\n try {\n const result = await this.client.synonymMaps.get(\n synonymMapName,\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n return utils.generatedSynonymMapToPublicSynonymMap(result);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a new index.\n * @param index - The information describing the index to be created.\n * @param options - Additional optional arguments.\n */\n public async createIndex(\n index: SearchIndex,\n options: CreateIndexOptions = {}\n ): Promise<SearchIndex> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-createIndex\", options);\n try {\n const result = await this.client.indexes.create(\n utils.publicIndexToGeneratedIndex(index),\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n return utils.generatedIndexToPublicIndex(result);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a new SynonymMap in a search service.\n * @param synonymMap - The synonymMap definition to create in a search service.\n * @param options - Additional optional arguments.\n */\n public async createSynonymMap(\n synonymMap: SynonymMap,\n options: CreateSynonymMapOptions = {}\n ): Promise<SynonymMap> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-createSynonymMaps\", options);\n try {\n const result = await this.client.synonymMaps.create(\n utils.publicSynonymMapToGeneratedSynonymMap(synonymMap),\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n return utils.generatedSynonymMapToPublicSynonymMap(result);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a new index or modifies an existing one.\n * @param index - The information describing the index to be created.\n * @param options - Additional optional arguments.\n */\n public async createOrUpdateIndex(\n index: SearchIndex,\n options: CreateOrUpdateIndexOptions = {}\n ): Promise<SearchIndex> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-createOrUpdateIndex\", options);\n try {\n const etag = options.onlyIfUnchanged ? index.etag : undefined;\n\n const result = await this.client.indexes.createOrUpdate(\n index.name,\n utils.publicIndexToGeneratedIndex(index),\n {\n ...operationOptionsToRequestOptionsBase(updatedOptions),\n ifMatch: etag\n }\n );\n return utils.generatedIndexToPublicIndex(result);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a new SynonymMap or modifies an existing one.\n * @param synonymMap - The information describing the SynonymMap to be created.\n * @param options - Additional optional arguments.\n */\n public async createOrUpdateSynonymMap(\n synonymMap: SynonymMap,\n options: CreateOrUpdateSynonymMapOptions = {}\n ): Promise<SynonymMap> {\n const { span, updatedOptions } = createSpan(\n \"SearchIndexClient-createOrUpdateSynonymMap\",\n options\n );\n try {\n const etag = options.onlyIfUnchanged ? synonymMap.etag : undefined;\n\n const result = await this.client.synonymMaps.createOrUpdate(\n synonymMap.name,\n utils.publicSynonymMapToGeneratedSynonymMap(synonymMap),\n {\n ...operationOptionsToRequestOptionsBase(updatedOptions),\n ifMatch: etag\n }\n );\n return utils.generatedSynonymMapToPublicSynonymMap(result);\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes an existing index.\n * @param indexName - Index/Name of the index to delete.\n * @param options - Additional optional arguments.\n */\n public async deleteIndex(\n index: string | SearchIndex,\n options: DeleteIndexOptions = {}\n ): Promise<void> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-deleteIndex\", options);\n try {\n const indexName: string = typeof index === \"string\" ? index : index.name;\n const etag =\n typeof index === \"string\" ? undefined : options.onlyIfUnchanged ? index.etag : undefined;\n\n await this.client.indexes.delete(indexName, {\n ...operationOptionsToRequestOptionsBase(updatedOptions),\n ifMatch: etag\n });\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes an existing SynonymMap.\n * @param synonymMapName - SynonymMap/Name of the synonymMap to delete.\n * @param options - Additional optional arguments.\n */\n public async deleteSynonymMap(\n synonymMap: string | SynonymMap,\n options: DeleteSynonymMapOptions = {}\n ): Promise<void> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-deleteSynonymMap\", options);\n try {\n const synonymMapName: string = typeof synonymMap === \"string\" ? synonymMap : synonymMap.name;\n const etag =\n typeof synonymMap === \"string\"\n ? undefined\n : options.onlyIfUnchanged\n ? synonymMap.etag\n : undefined;\n\n await this.client.synonymMaps.delete(synonymMapName, {\n ...operationOptionsToRequestOptionsBase(updatedOptions),\n ifMatch: etag\n });\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves statistics about an index, such as the count of documents and the size\n * of index storage.\n * @param indexName - The name of the index.\n * @param options - Additional optional arguments.\n */\n public async getIndexStatistics(\n indexName: string,\n options: GetIndexStatisticsOptions = {}\n ): Promise<SearchIndexStatistics> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-getIndexStatistics\", options);\n try {\n const result = await this.client.indexes.getStatistics(\n indexName,\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n return result;\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Calls an analyzer or tokenizer manually on provided text.\n * @param indexName - The name of the index that contains the field to analyze\n * @param text - The text to break into tokens.\n * @param options - Additional arguments\n */\n public async analyzeText(indexName: string, options: AnalyzeTextOptions): Promise<AnalyzeResult> {\n const { operationOptions, restOptions } = utils.extractOperationOptions(options);\n\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-analyzeText\", operationOptions);\n try {\n const result = await this.client.indexes.analyze(\n indexName,\n {\n ...restOptions,\n analyzer: restOptions.analyzerName,\n tokenizer: restOptions.tokenizerName\n },\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n return result;\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves statistics about the service, such as the count of documents, index, etc.\n * @param options - Additional optional arguments.\n */\n public async getServiceStatistics(\n options: GetServiceStatisticsOptions = {}\n ): Promise<SearchServiceStatistics> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-getServiceStatistics\", options);\n try {\n const result = await this.client.getServiceStatistics(\n operationOptionsToRequestOptionsBase(updatedOptions)\n );\n return result;\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves the SearchClient corresponding to this SearchIndexClient\n * @param indexName - Name of the index\n * @param options - SearchClient Options\n */\n public getSearchClient<T>(indexName: string, options?: GetSearchClientOptions): SearchClient<T> {\n return new SearchClient<T>(this.endpoint, indexName, this.credential, options || this.options);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"searchIndexClient.js","sourceRoot":"","sources":["../../src/searchIndexClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,4CAA4C;AAE5C,OAAO,EAAkC,iBA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MIT license.\n\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { KeyCredential, TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { InternalClientPipelineOptions } from \"@azure/core-client\";\nimport {\n LogPolicyOptions,\n UserAgentPolicyOptions,\n bearerTokenAuthenticationPolicy,\n} from \"@azure/core-rest-pipeline\";\nimport { AnalyzeResult } from \"./generated/service/models\";\nimport { SearchServiceClient as GeneratedClient } from \"./generated/service/searchServiceClient\";\nimport { logger } from \"./logger\";\nimport { createSearchApiKeyCredentialPolicy } from \"./searchApiKeyCredentialPolicy\";\nimport {\n AnalyzeTextOptions,\n CreateIndexOptions,\n CreateOrUpdateIndexOptions,\n CreateOrUpdateSynonymMapOptions,\n CreateSynonymMapOptions,\n DeleteIndexOptions,\n DeleteSynonymMapOptions,\n GetIndexOptions,\n GetIndexStatisticsOptions,\n GetServiceStatisticsOptions,\n GetSynonymMapsOptions,\n IndexIterator,\n IndexNameIterator,\n ListIndexesOptions,\n ListSynonymMapsOptions,\n SearchIndex,\n SearchIndexStatistics,\n SearchServiceStatistics,\n SynonymMap,\n} from \"./serviceModels\";\nimport * as utils from \"./serviceUtils\";\nimport { createSpan } from \"./tracing\";\nimport { createOdataMetadataPolicy } from \"./odataMetadataPolicy\";\nimport { SearchClientOptions as GetSearchClientOptions, SearchClient } from \"./searchClient\";\nimport { ExtendedCommonClientOptions } from \"@azure/core-http-compat\";\nimport { KnownSearchAudience } from \"./searchAudience\";\nimport { SDK_VERSION } from \"./constants\";\n\n/**\n * Client options used to configure Cognitive Search API requests.\n */\nexport interface SearchIndexClientOptions extends ExtendedCommonClientOptions {\n /**\n * The API version to use when communicating with the service.\n */\n apiVersion?: string;\n\n /**\n * The Audience to use for authentication with Azure Active Directory (AAD). The\n * audience is not considered when using a shared key.\n * {@link KnownSearchAudience} can be used interchangeably with audience\n */\n audience?: string;\n}\n\n/**\n * Class to perform operations to manage\n * (create, update, list/delete)\n * indexes, & synonymmaps.\n */\nexport class SearchIndexClient {\n /**\n * The API version to use when communicating with the service.\n */\n public readonly apiVersion: string = utils.defaultServiceVersion;\n\n /**\n * The endpoint of the search service\n */\n public readonly endpoint: string;\n\n /**\n * @internal\n * @hidden\n * A reference to the auto-generated SearchServiceClient\n */\n private readonly client: GeneratedClient;\n\n /**\n * Used to authenticate requests to the service.\n */\n private readonly credential: KeyCredential | TokenCredential;\n\n /**\n * Used to configure the Search Index client.\n */\n private readonly options: SearchIndexClientOptions;\n\n /**\n * Creates an instance of SearchIndexClient.\n *\n * Example usage:\n * ```ts\n * const { SearchIndexClient, AzureKeyCredential } = require(\"@azure/search-documents\");\n *\n * const client = new SearchIndexClient(\n * \"<endpoint>\",\n * new AzureKeyCredential(\"<Admin Key>\");\n * );\n * ```\n * @param endpoint - The endpoint of the search service\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Search Index client.\n */\n constructor(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options: SearchIndexClientOptions = {}\n ) {\n this.endpoint = endpoint;\n this.credential = credential;\n this.options = options;\n\n const libInfo = `azsdk-js-search-documents/${SDK_VERSION}`;\n const userAgentOptions: UserAgentPolicyOptions = {\n ...this.options.userAgentOptions,\n userAgentPrefix: this.options.userAgentOptions?.userAgentPrefix\n ? `${this.options.userAgentOptions.userAgentPrefix} ${libInfo}`\n : libInfo,\n };\n\n const loggingOptions: LogPolicyOptions = {\n logger: logger.info,\n additionalAllowedHeaderNames: [\n \"elapsed-time\",\n \"Location\",\n \"OData-MaxVersion\",\n \"OData-Version\",\n \"Prefer\",\n \"throttle-reason\",\n ],\n };\n\n const internalClientPipelineOptions: InternalClientPipelineOptions = {\n ...this.options,\n userAgentOptions,\n loggingOptions,\n };\n\n this.apiVersion = options.apiVersion ?? utils.defaultServiceVersion;\n\n this.client = new GeneratedClient(\n this.endpoint,\n this.apiVersion,\n internalClientPipelineOptions\n );\n\n if (isTokenCredential(credential)) {\n const scope: string = this.options.audience\n ? `${this.options.audience}/.default`\n : `${KnownSearchAudience.AzurePublicCloud}/.default`;\n\n this.client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({ credential, scopes: scope })\n );\n } else {\n this.client.pipeline.addPolicy(createSearchApiKeyCredentialPolicy(credential));\n }\n\n this.client.pipeline.addPolicy(createOdataMetadataPolicy(\"minimal\"));\n }\n\n private async *listIndexesPage(\n options: ListIndexesOptions = {}\n ): AsyncIterableIterator<SearchIndex[]> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-listIndexesPage\", options);\n try {\n const result = await this.client.indexes.list(updatedOptions);\n const mapped = result.indexes.map(utils.generatedIndexToPublicIndex);\n yield mapped;\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n private async *listIndexesAll(\n options: ListIndexesOptions = {}\n ): AsyncIterableIterator<SearchIndex> {\n for await (const page of this.listIndexesPage(options)) {\n yield* page;\n }\n }\n\n /**\n * Retrieves a list of existing indexes in the service.\n * @param options - Options to the list index operation.\n */\n public listIndexes(options: ListIndexesOptions = {}): IndexIterator {\n const iter = this.listIndexesAll(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listIndexesPage(options);\n },\n };\n }\n\n private async *listIndexesNamesPage(\n options: ListIndexesOptions = {}\n ): AsyncIterableIterator<string[]> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-listIndexesNamesPage\", options);\n try {\n const result = await this.client.indexes.list({\n ...updatedOptions,\n select: \"name\",\n });\n const mapped = result.indexes.map((idx) => idx.name);\n yield mapped;\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n private async *listIndexesNamesAll(\n options: ListIndexesOptions = {}\n ): AsyncIterableIterator<string> {\n for await (const page of this.listIndexesNamesPage(options)) {\n yield* page;\n }\n }\n\n /**\n * Retrieves a list of names of existing indexes in the service.\n * @param options - Options to the list index operation.\n */\n public listIndexesNames(options: ListIndexesOptions = {}): IndexNameIterator {\n const iter = this.listIndexesNamesAll(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return this.listIndexesNamesPage(options);\n },\n };\n }\n\n /**\n * Retrieves a list of existing SynonymMaps in the service.\n * @param options - Options to the list SynonymMaps operation.\n */\n public async listSynonymMaps(options: ListSynonymMapsOptions = {}): Promise<Array<SynonymMap>> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-listSynonymMaps\", options);\n try {\n const result = await this.client.synonymMaps.list(updatedOptions);\n return result.synonymMaps.map(utils.generatedSynonymMapToPublicSynonymMap);\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves a list of names of existing SynonymMaps in the service.\n * @param options - Options to the list SynonymMaps operation.\n */\n public async listSynonymMapsNames(options: ListSynonymMapsOptions = {}): Promise<Array<string>> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-listSynonymMapsNames\", options);\n try {\n const result = await this.client.synonymMaps.list({\n ...updatedOptions,\n select: \"name\",\n });\n return result.synonymMaps.map((sm) => sm.name);\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves information about an index.\n * @param indexName - The name of the index.\n * @param options - Additional optional arguments.\n */\n public async getIndex(indexName: string, options: GetIndexOptions = {}): Promise<SearchIndex> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-getIndex\", options);\n try {\n const result = await this.client.indexes.get(indexName, updatedOptions);\n return utils.generatedIndexToPublicIndex(result);\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves information about a SynonymMap.\n * @param synonymMapName - The name of the SynonymMap.\n * @param options - Additional optional arguments.\n */\n public async getSynonymMap(\n synonymMapName: string,\n options: GetSynonymMapsOptions = {}\n ): Promise<SynonymMap> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-getSynonymMaps\", options);\n try {\n const result = await this.client.synonymMaps.get(synonymMapName, updatedOptions);\n return utils.generatedSynonymMapToPublicSynonymMap(result);\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a new index.\n * @param index - The information describing the index to be created.\n * @param options - Additional optional arguments.\n */\n public async createIndex(\n index: SearchIndex,\n options: CreateIndexOptions = {}\n ): Promise<SearchIndex> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-createIndex\", options);\n try {\n const result = await this.client.indexes.create(\n utils.publicIndexToGeneratedIndex(index),\n updatedOptions\n );\n return utils.generatedIndexToPublicIndex(result);\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a new SynonymMap in a search service.\n * @param synonymMap - The synonymMap definition to create in a search service.\n * @param options - Additional optional arguments.\n */\n public async createSynonymMap(\n synonymMap: SynonymMap,\n options: CreateSynonymMapOptions = {}\n ): Promise<SynonymMap> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-createSynonymMaps\", options);\n try {\n const result = await this.client.synonymMaps.create(\n utils.publicSynonymMapToGeneratedSynonymMap(synonymMap),\n updatedOptions\n );\n return utils.generatedSynonymMapToPublicSynonymMap(result);\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a new index or modifies an existing one.\n * @param index - The information describing the index to be created.\n * @param options - Additional optional arguments.\n */\n public async createOrUpdateIndex(\n index: SearchIndex,\n options: CreateOrUpdateIndexOptions = {}\n ): Promise<SearchIndex> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-createOrUpdateIndex\", options);\n try {\n const etag = options.onlyIfUnchanged ? index.etag : undefined;\n\n const result = await this.client.indexes.createOrUpdate(\n index.name,\n utils.publicIndexToGeneratedIndex(index),\n {\n ...updatedOptions,\n ifMatch: etag,\n }\n );\n return utils.generatedIndexToPublicIndex(result);\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a new SynonymMap or modifies an existing one.\n * @param synonymMap - The information describing the SynonymMap to be created.\n * @param options - Additional optional arguments.\n */\n public async createOrUpdateSynonymMap(\n synonymMap: SynonymMap,\n options: CreateOrUpdateSynonymMapOptions = {}\n ): Promise<SynonymMap> {\n const { span, updatedOptions } = createSpan(\n \"SearchIndexClient-createOrUpdateSynonymMap\",\n options\n );\n try {\n const etag = options.onlyIfUnchanged ? synonymMap.etag : undefined;\n\n const result = await this.client.synonymMaps.createOrUpdate(\n synonymMap.name,\n utils.publicSynonymMapToGeneratedSynonymMap(synonymMap),\n {\n ...updatedOptions,\n ifMatch: etag,\n }\n );\n return utils.generatedSynonymMapToPublicSynonymMap(result);\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes an existing index.\n * @param indexName - Index/Name of the index to delete.\n * @param options - Additional optional arguments.\n */\n public async deleteIndex(\n index: string | SearchIndex,\n options: DeleteIndexOptions = {}\n ): Promise<void> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-deleteIndex\", options);\n try {\n const indexName: string = typeof index === \"string\" ? index : index.name;\n const etag =\n typeof index === \"string\" ? undefined : options.onlyIfUnchanged ? index.etag : undefined;\n\n await this.client.indexes.delete(indexName, {\n ...updatedOptions,\n ifMatch: etag,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes an existing SynonymMap.\n * @param synonymMapName - SynonymMap/Name of the synonymMap to delete.\n * @param options - Additional optional arguments.\n */\n public async deleteSynonymMap(\n synonymMap: string | SynonymMap,\n options: DeleteSynonymMapOptions = {}\n ): Promise<void> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-deleteSynonymMap\", options);\n try {\n const synonymMapName: string = typeof synonymMap === \"string\" ? synonymMap : synonymMap.name;\n const etag =\n typeof synonymMap === \"string\"\n ? undefined\n : options.onlyIfUnchanged\n ? synonymMap.etag\n : undefined;\n\n await this.client.synonymMaps.delete(synonymMapName, {\n ...updatedOptions,\n ifMatch: etag,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves statistics about an index, such as the count of documents and the size\n * of index storage.\n * @param indexName - The name of the index.\n * @param options - Additional optional arguments.\n */\n public async getIndexStatistics(\n indexName: string,\n options: GetIndexStatisticsOptions = {}\n ): Promise<SearchIndexStatistics> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-getIndexStatistics\", options);\n try {\n const result = await this.client.indexes.getStatistics(indexName, updatedOptions);\n return result;\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Calls an analyzer or tokenizer manually on provided text.\n * @param indexName - The name of the index that contains the field to analyze\n * @param text - The text to break into tokens.\n * @param options - Additional arguments\n */\n public async analyzeText(indexName: string, options: AnalyzeTextOptions): Promise<AnalyzeResult> {\n const { abortSignal, requestOptions, tracingOptions, ...restOptions } = options;\n const operationOptions = {\n abortSignal,\n requestOptions,\n tracingOptions,\n };\n\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-analyzeText\", operationOptions);\n try {\n const result = await this.client.indexes.analyze(\n indexName,\n {\n ...restOptions,\n analyzer: restOptions.analyzerName,\n tokenizer: restOptions.tokenizerName,\n },\n updatedOptions\n );\n return result;\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves statistics about the service, such as the count of documents, index, etc.\n * @param options - Additional optional arguments.\n */\n public async getServiceStatistics(\n options: GetServiceStatisticsOptions = {}\n ): Promise<SearchServiceStatistics> {\n const { span, updatedOptions } = createSpan(\"SearchIndexClient-getServiceStatistics\", options);\n try {\n const result = await this.client.getServiceStatistics(updatedOptions);\n return result;\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e.message,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Retrieves the SearchClient corresponding to this SearchIndexClient\n * @param indexName - Name of the index\n * @param options - SearchClient Options\n * @typeParam TModel - An optional type that represents the documents stored in\n * the search index. For the best typing experience, all non-key fields should\n * be marked optional and nullable, and the key property should have the\n * non-nullable type `string`.\n */\n public getSearchClient<TModel>(\n indexName: string,\n options?: GetSearchClientOptions\n ): SearchClient<TModel> {\n return new SearchClient<TModel>(\n this.endpoint,\n indexName,\n this.credential,\n options || this.options\n );\n }\n}\n"]}
|