@azure/search-documents 11.3.0-alpha.20211213.3 → 11.3.0-alpha.20220112.1

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.
Files changed (32) hide show
  1. package/dist/index.js +154 -128
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/geographyPoint.js +1 -1
  4. package/dist-esm/src/geographyPoint.js.map +1 -1
  5. package/dist-esm/src/index.js +4 -4
  6. package/dist-esm/src/index.js.map +1 -1
  7. package/dist-esm/src/indexDocumentsBatch.js +1 -1
  8. package/dist-esm/src/indexDocumentsBatch.js.map +1 -1
  9. package/dist-esm/src/indexModels.js.map +1 -1
  10. package/dist-esm/src/odataMetadataPolicy.js +1 -1
  11. package/dist-esm/src/odataMetadataPolicy.js.map +1 -1
  12. package/dist-esm/src/searchApiKeyCredentialPolicy.js +1 -1
  13. package/dist-esm/src/searchApiKeyCredentialPolicy.js.map +1 -1
  14. package/dist-esm/src/searchClient.js +32 -32
  15. package/dist-esm/src/searchClient.js.map +1 -1
  16. package/dist-esm/src/searchIndexClient.js +38 -26
  17. package/dist-esm/src/searchIndexClient.js.map +1 -1
  18. package/dist-esm/src/searchIndexerClient.js +44 -32
  19. package/dist-esm/src/searchIndexerClient.js.map +1 -1
  20. package/dist-esm/src/searchIndexingBufferedSender.js +10 -10
  21. package/dist-esm/src/searchIndexingBufferedSender.js.map +1 -1
  22. package/dist-esm/src/serialization.js +5 -5
  23. package/dist-esm/src/serialization.js.map +1 -1
  24. package/dist-esm/src/serviceModels.js.map +1 -1
  25. package/dist-esm/src/serviceUtils.js +20 -18
  26. package/dist-esm/src/serviceUtils.js.map +1 -1
  27. package/dist-esm/src/synonymMapHelper.js +1 -1
  28. package/dist-esm/src/synonymMapHelper.js.map +1 -1
  29. package/dist-esm/src/tracing.js +1 -1
  30. package/dist-esm/src/tracing.js.map +1 -1
  31. package/package.json +4 -3
  32. package/types/search-documents.d.ts +21 -1
package/dist/index.js CHANGED
@@ -1787,7 +1787,7 @@ function createSearchApiKeyCredentialPolicy(credential) {
1787
1787
  request.headers.set(API_KEY_HEADER_NAME, credential.key);
1788
1788
  }
1789
1789
  return next(request);
1790
- }
1790
+ },
1791
1791
  };
1792
1792
  }
1793
1793
 
@@ -1808,7 +1808,7 @@ const logger = logger$1.createClientLogger("search");
1808
1808
  */
1809
1809
  const createSpan = coreTracing.createSpanFunction({
1810
1810
  packagePrefix: "Azure.Search",
1811
- namespace: "Microsoft.Search"
1811
+ namespace: "Microsoft.Search",
1812
1812
  });
1813
1813
 
1814
1814
  // Copyright (c) Microsoft Corporation.
@@ -1834,7 +1834,7 @@ class GeographyPoint {
1834
1834
  return {
1835
1835
  type: "Point",
1836
1836
  coordinates: [this.longitude, this.latitude],
1837
- crs: { type: "name", properties: { name: WorldGeodeticSystem1984 } }
1837
+ crs: { type: "name", properties: { name: WorldGeodeticSystem1984 } },
1838
1838
  };
1839
1839
  }
1840
1840
  }
@@ -1862,7 +1862,7 @@ function walk(start, mapper) {
1862
1862
  const seenMarker = new WeakMap();
1863
1863
  const result = { value: undefined };
1864
1864
  const queue = [
1865
- { value: start, parent: result, key: "value" }
1865
+ { value: start, parent: result, key: "value" },
1866
1866
  ];
1867
1867
  while (queue.length) {
1868
1868
  const current = queue.shift();
@@ -1883,7 +1883,7 @@ function walk(start, mapper) {
1883
1883
  queue.push({
1884
1884
  value: mapped[key],
1885
1885
  parent: mapped,
1886
- key
1886
+ key,
1887
1887
  });
1888
1888
  }
1889
1889
  }
@@ -1947,7 +1947,7 @@ function isGeoJSONPoint(obj) {
1947
1947
  default:
1948
1948
  return false;
1949
1949
  }
1950
- }
1950
+ },
1951
1951
  });
1952
1952
  }
1953
1953
  function isCoordinateArray(maybeCoordinates) {
@@ -1974,7 +1974,7 @@ function isCrs(maybeCrs) {
1974
1974
  default:
1975
1975
  return false;
1976
1976
  }
1977
- }
1977
+ },
1978
1978
  });
1979
1979
  }
1980
1980
  function isCrsProperties(maybeProperties) {
@@ -1987,7 +1987,7 @@ function isCrsProperties(maybeProperties) {
1987
1987
  else {
1988
1988
  return false;
1989
1989
  }
1990
- }
1990
+ },
1991
1991
  });
1992
1992
  }
1993
1993
  function isValidObject(obj, options = {}) {
@@ -2026,7 +2026,7 @@ function createOdataMetadataPolicy(metadataLevel) {
2026
2026
  async sendRequest(request, next) {
2027
2027
  request.headers.set(AcceptHeaderName, `application/json;odata.metadata=${metadataLevel}`);
2028
2028
  return next(request);
2029
- }
2029
+ },
2030
2030
  };
2031
2031
  }
2032
2032
 
@@ -2078,7 +2078,7 @@ class IndexDocumentsBatch {
2078
2078
  const batch = keyValues.map((keyValue) => {
2079
2079
  return {
2080
2080
  __actionType: "delete",
2081
- [keyName]: keyValue
2081
+ [keyName]: keyValue,
2082
2082
  };
2083
2083
  });
2084
2084
  this.actions.push(...batch);
@@ -2893,7 +2893,7 @@ function convertFieldsToPublic(fields) {
2893
2893
  return {
2894
2894
  name: field.name,
2895
2895
  type: field.type,
2896
- fields: convertFieldsToPublic(field.fields)
2896
+ fields: convertFieldsToPublic(field.fields),
2897
2897
  };
2898
2898
  }
2899
2899
  else {
@@ -2921,7 +2921,7 @@ function convertFieldsToGenerated(fields) {
2921
2921
  return {
2922
2922
  name: field.name,
2923
2923
  type: field.type,
2924
- fields: convertFieldsToGenerated(field.fields)
2924
+ fields: convertFieldsToGenerated(field.fields),
2925
2925
  };
2926
2926
  }
2927
2927
  else {
@@ -2990,7 +2990,7 @@ function convertEncryptionKeyToPublic(encryptionKey) {
2990
2990
  keyName: encryptionKey.keyName,
2991
2991
  keyVersion: encryptionKey.keyVersion,
2992
2992
  vaultUrl: encryptionKey.vaultUri,
2993
- identity: convertSearchIndexerDataIdentityToPublic(encryptionKey.identity)
2993
+ identity: convertSearchIndexerDataIdentityToPublic(encryptionKey.identity),
2994
2994
  };
2995
2995
  if (encryptionKey.accessCredentials) {
2996
2996
  result.applicationId = encryptionKey.accessCredentials.applicationId;
@@ -3006,12 +3006,12 @@ function convertEncryptionKeyToGenerated(encryptionKey) {
3006
3006
  keyName: encryptionKey.keyName,
3007
3007
  keyVersion: encryptionKey.keyVersion,
3008
3008
  vaultUri: encryptionKey.vaultUrl,
3009
- identity: encryptionKey.identity
3009
+ identity: encryptionKey.identity,
3010
3010
  };
3011
3011
  if (encryptionKey.applicationId) {
3012
3012
  result.accessCredentials = {
3013
3013
  applicationId: encryptionKey.applicationId,
3014
- applicationSecret: encryptionKey.applicationSecret
3014
+ applicationSecret: encryptionKey.applicationSecret,
3015
3015
  };
3016
3016
  }
3017
3017
  return result;
@@ -3032,7 +3032,7 @@ function generatedIndexToPublicIndex(generatedIndex) {
3032
3032
  scoringProfiles: generatedIndex.scoringProfiles,
3033
3033
  fields: convertFieldsToPublic(generatedIndex.fields),
3034
3034
  similarity: convertSimilarityToPublic(generatedIndex.similarity),
3035
- semanticSettings: generatedIndex.semanticSettings
3035
+ semanticSettings: generatedIndex.semanticSettings,
3036
3036
  };
3037
3037
  }
3038
3038
  function generatedSearchResultToPublicSearchResult(results) {
@@ -3044,7 +3044,7 @@ function generatedSearchResultToPublicSearchResult(results) {
3044
3044
  highlights: _highlights,
3045
3045
  rerankerScore,
3046
3046
  captions,
3047
- document: doc
3047
+ document: doc,
3048
3048
  };
3049
3049
  return obj;
3050
3050
  });
@@ -3056,13 +3056,13 @@ function generatedSuggestDocumentsResultToPublicSuggestDocumentsResult(searchDoc
3056
3056
  const doc = Object.assign({}, restProps);
3057
3057
  const obj = {
3058
3058
  text: _text,
3059
- document: doc
3059
+ document: doc,
3060
3060
  };
3061
3061
  return obj;
3062
3062
  });
3063
3063
  const result = {
3064
3064
  results: results,
3065
- coverage: searchDocumentsResult.coverage
3065
+ coverage: searchDocumentsResult.coverage,
3066
3066
  };
3067
3067
  return result;
3068
3068
  }
@@ -3082,7 +3082,7 @@ function publicIndexToGeneratedIndex(index) {
3082
3082
  tokenizers: convertTokenizersToGenerated(index.tokenizers),
3083
3083
  fields: convertFieldsToGenerated(index.fields),
3084
3084
  similarity: convertSimilarityToGenerated(index.similarity),
3085
- semanticSettings: index.semanticSettings
3085
+ semanticSettings: index.semanticSettings,
3086
3086
  };
3087
3087
  }
3088
3088
  function generatedSkillsetToPublicSkillset(generatedSkillset) {
@@ -3093,7 +3093,7 @@ function generatedSkillsetToPublicSkillset(generatedSkillset) {
3093
3093
  cognitiveServicesAccount: convertCognitiveServicesAccountToPublic(generatedSkillset.cognitiveServicesAccount),
3094
3094
  knowledgeStore: generatedSkillset.knowledgeStore,
3095
3095
  etag: generatedSkillset.etag,
3096
- encryptionKey: convertEncryptionKeyToPublic(generatedSkillset.encryptionKey)
3096
+ encryptionKey: convertEncryptionKeyToPublic(generatedSkillset.encryptionKey),
3097
3097
  };
3098
3098
  }
3099
3099
  function publicSkillsetToGeneratedSkillset(skillset) {
@@ -3104,7 +3104,7 @@ function publicSkillsetToGeneratedSkillset(skillset) {
3104
3104
  skills: skillset.skills,
3105
3105
  cognitiveServicesAccount: convertCognitiveServicesAccountToGenerated(skillset.cognitiveServicesAccount),
3106
3106
  knowledgeStore: skillset.knowledgeStore,
3107
- encryptionKey: convertEncryptionKeyToGenerated(skillset.encryptionKey)
3107
+ encryptionKey: convertEncryptionKeyToGenerated(skillset.encryptionKey),
3108
3108
  };
3109
3109
  }
3110
3110
  function generatedSynonymMapToPublicSynonymMap(synonymMap) {
@@ -3112,7 +3112,7 @@ function generatedSynonymMapToPublicSynonymMap(synonymMap) {
3112
3112
  name: synonymMap.name,
3113
3113
  encryptionKey: convertEncryptionKeyToPublic(synonymMap.encryptionKey),
3114
3114
  etag: synonymMap.etag,
3115
- synonyms: []
3115
+ synonyms: [],
3116
3116
  };
3117
3117
  if (synonymMap.synonyms) {
3118
3118
  result.synonyms = synonymMap.synonyms.split("\n");
@@ -3125,7 +3125,7 @@ function publicSynonymMapToGeneratedSynonymMap(synonymMap) {
3125
3125
  format: "solr",
3126
3126
  encryptionKey: convertEncryptionKeyToGenerated(synonymMap.encryptionKey),
3127
3127
  etag: synonymMap.etag,
3128
- synonyms: synonymMap.synonyms.join("\n")
3128
+ synonyms: synonymMap.synonyms.join("\n"),
3129
3129
  };
3130
3130
  result.encryptionKey = convertEncryptionKeyToGenerated(synonymMap.encryptionKey);
3131
3131
  return result;
@@ -3142,14 +3142,14 @@ function publicDataSourceToGeneratedDataSource(dataSource) {
3142
3142
  description: dataSource.description,
3143
3143
  type: dataSource.type,
3144
3144
  credentials: {
3145
- connectionString: dataSource.connectionString
3145
+ connectionString: dataSource.connectionString,
3146
3146
  },
3147
3147
  container: dataSource.container,
3148
3148
  identity: dataSource.identity,
3149
3149
  etag: dataSource.etag,
3150
3150
  dataChangeDetectionPolicy: dataSource.dataChangeDetectionPolicy,
3151
3151
  dataDeletionDetectionPolicy: dataSource.dataDeletionDetectionPolicy,
3152
- encryptionKey: convertEncryptionKeyToGenerated(dataSource.encryptionKey)
3152
+ encryptionKey: convertEncryptionKeyToGenerated(dataSource.encryptionKey),
3153
3153
  };
3154
3154
  }
3155
3155
  function generatedDataSourceToPublicDataSource(dataSource) {
@@ -3163,7 +3163,7 @@ function generatedDataSourceToPublicDataSource(dataSource) {
3163
3163
  etag: dataSource.etag,
3164
3164
  dataChangeDetectionPolicy: convertDataChangeDetectionPolicyToPublic(dataSource.dataChangeDetectionPolicy),
3165
3165
  dataDeletionDetectionPolicy: convertDataDeletionDetectionPolicyToPublic(dataSource.dataDeletionDetectionPolicy),
3166
- encryptionKey: convertEncryptionKeyToPublic(dataSource.encryptionKey)
3166
+ encryptionKey: convertEncryptionKeyToPublic(dataSource.encryptionKey),
3167
3167
  };
3168
3168
  }
3169
3169
  function convertSearchIndexerDataIdentityToPublic(searchIndexerDataIdentity) {
@@ -3213,6 +3213,8 @@ function getRandomIntegerInclusive(min, max) {
3213
3213
  function delay(timeInMs) {
3214
3214
  return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));
3215
3215
  }
3216
+ const serviceVersions = ["2020-06-30", "2021-04-30-Preview"];
3217
+ const defaultServiceVersion = "2021-04-30-Preview";
3216
3218
 
3217
3219
  // Copyright (c) Microsoft Corporation.
3218
3220
  /**
@@ -3245,7 +3247,12 @@ class SearchClient$1 {
3245
3247
  /**
3246
3248
  * The service version to use when communicating with the service.
3247
3249
  */
3248
- this.serviceVersion = "2020-06-30-Preview";
3250
+ this.serviceVersion = defaultServiceVersion;
3251
+ /**
3252
+ * The API version to use when communicating with the service.
3253
+ * @deprecated use {@Link serviceVersion} instead
3254
+ */
3255
+ this.apiVersion = defaultServiceVersion;
3249
3256
  this.endpoint = endpoint;
3250
3257
  this.indexName = indexName;
3251
3258
  const libInfo = `azsdk-js-search-documents/${SDK_VERSION}`;
@@ -3267,21 +3274,23 @@ class SearchClient$1 {
3267
3274
  "OData-MaxVersion",
3268
3275
  "OData-Version",
3269
3276
  "Prefer",
3270
- "throttle-reason"
3271
- ]
3272
- }
3277
+ "throttle-reason",
3278
+ ],
3279
+ },
3273
3280
  });
3274
3281
  if (options.apiVersion) {
3275
- if (!["2020-06-30", "2021-04-30-Preview"].includes(options.apiVersion)) {
3282
+ if (!serviceVersions.includes(options.apiVersion)) {
3276
3283
  throw new Error(`Invalid Api Version: ${options.apiVersion}`);
3277
3284
  }
3278
3285
  this.serviceVersion = options.apiVersion;
3286
+ this.apiVersion = options.apiVersion;
3279
3287
  }
3280
3288
  if (options.serviceVersion) {
3281
- if (!["2020-06-30", "2021-04-30-Preview"].includes(options.serviceVersion)) {
3289
+ if (!serviceVersions.includes(options.serviceVersion)) {
3282
3290
  throw new Error(`Invalid Service Version: ${options.serviceVersion}`);
3283
3291
  }
3284
3292
  this.serviceVersion = options.serviceVersion;
3293
+ this.apiVersion = options.serviceVersion;
3285
3294
  }
3286
3295
  this.client = new SearchClient(this.endpoint, this.indexName, this.serviceVersion, internalClientPipelineOptions);
3287
3296
  if (coreAuth.isTokenCredential(credential)) {
@@ -3292,13 +3301,6 @@ class SearchClient$1 {
3292
3301
  }
3293
3302
  this.client.pipeline.addPolicy(createOdataMetadataPolicy("none"));
3294
3303
  }
3295
- /**
3296
- * The API version to use when communicating with the service.
3297
- * @deprecated use {@Link serviceVersion} instead
3298
- */
3299
- get apiVersion() {
3300
- return this.serviceVersion;
3301
- }
3302
3304
  /**
3303
3305
  * Retrieves the number of documents in the index.
3304
3306
  * @param options - Options to the count operation.
@@ -3315,7 +3317,7 @@ class SearchClient$1 {
3315
3317
  catch (e) {
3316
3318
  span.setStatus({
3317
3319
  code: coreTracing.SpanStatusCode.ERROR,
3318
- message: e.message
3320
+ message: e.message,
3319
3321
  });
3320
3322
  throw e;
3321
3323
  }
@@ -3348,7 +3350,7 @@ class SearchClient$1 {
3348
3350
  catch (e) {
3349
3351
  span.setStatus({
3350
3352
  code: coreTracing.SpanStatusCode.ERROR,
3351
- message: e.message
3353
+ message: e.message,
3352
3354
  });
3353
3355
  throw e;
3354
3356
  }
@@ -3371,14 +3373,14 @@ class SearchClient$1 {
3371
3373
  coverage,
3372
3374
  facets,
3373
3375
  answers,
3374
- continuationToken: this.encodeContinuationToken(nextLink, result.nextPageParameters)
3376
+ continuationToken: this.encodeContinuationToken(nextLink, result.nextPageParameters),
3375
3377
  };
3376
3378
  return deserialize(converted);
3377
3379
  }
3378
3380
  catch (e) {
3379
3381
  span.setStatus({
3380
3382
  code: coreTracing.SpanStatusCode.ERROR,
3381
- message: e.message
3383
+ message: e.message,
3382
3384
  });
3383
3385
  throw e;
3384
3386
  }
@@ -3407,7 +3409,7 @@ class SearchClient$1 {
3407
3409
  if (firstPage.continuationToken) {
3408
3410
  try {
3409
3411
  for (var _b = tslib.__asyncValues(this.listSearchResultsPage(searchText, options, {
3410
- continuationToken: firstPage.continuationToken
3412
+ continuationToken: firstPage.continuationToken,
3411
3413
  })), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
3412
3414
  const page = _c.value;
3413
3415
  yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page.results)));
@@ -3434,7 +3436,7 @@ class SearchClient$1 {
3434
3436
  },
3435
3437
  byPage: (settings = {}) => {
3436
3438
  return this.listSearchResultsPage(searchText, options, settings);
3437
- }
3439
+ },
3438
3440
  };
3439
3441
  }
3440
3442
  /**
@@ -3453,13 +3455,13 @@ class SearchClient$1 {
3453
3455
  coverage,
3454
3456
  facets,
3455
3457
  answers,
3456
- results: this.listSearchResults(pageResult, searchText, updatedOptions)
3458
+ results: this.listSearchResults(pageResult, searchText, updatedOptions),
3457
3459
  };
3458
3460
  }
3459
3461
  catch (e) {
3460
3462
  span.setStatus({
3461
3463
  code: coreTracing.SpanStatusCode.ERROR,
3462
- message: e.message
3464
+ message: e.message,
3463
3465
  });
3464
3466
  throw e;
3465
3467
  }
@@ -3493,7 +3495,7 @@ class SearchClient$1 {
3493
3495
  catch (e) {
3494
3496
  span.setStatus({
3495
3497
  code: coreTracing.SpanStatusCode.ERROR,
3496
- message: e.message
3498
+ message: e.message,
3497
3499
  });
3498
3500
  throw e;
3499
3501
  }
@@ -3515,7 +3517,7 @@ class SearchClient$1 {
3515
3517
  catch (e) {
3516
3518
  span.setStatus({
3517
3519
  code: coreTracing.SpanStatusCode.ERROR,
3518
- message: e.message
3520
+ message: e.message,
3519
3521
  });
3520
3522
  throw e;
3521
3523
  }
@@ -3550,7 +3552,7 @@ class SearchClient$1 {
3550
3552
  catch (e) {
3551
3553
  span.setStatus({
3552
3554
  code: coreTracing.SpanStatusCode.ERROR,
3553
- message: e.message
3555
+ message: e.message,
3554
3556
  });
3555
3557
  throw e;
3556
3558
  }
@@ -3573,7 +3575,7 @@ class SearchClient$1 {
3573
3575
  catch (e) {
3574
3576
  span.setStatus({
3575
3577
  code: coreTracing.SpanStatusCode.ERROR,
3576
- message: e.message
3578
+ message: e.message,
3577
3579
  });
3578
3580
  throw e;
3579
3581
  }
@@ -3597,7 +3599,7 @@ class SearchClient$1 {
3597
3599
  catch (e) {
3598
3600
  span.setStatus({
3599
3601
  code: coreTracing.SpanStatusCode.ERROR,
3600
- message: e.message
3602
+ message: e.message,
3601
3603
  });
3602
3604
  throw e;
3603
3605
  }
@@ -3621,7 +3623,7 @@ class SearchClient$1 {
3621
3623
  catch (e) {
3622
3624
  span.setStatus({
3623
3625
  code: coreTracing.SpanStatusCode.ERROR,
3624
- message: e.message
3626
+ message: e.message,
3625
3627
  });
3626
3628
  throw e;
3627
3629
  }
@@ -3644,7 +3646,7 @@ class SearchClient$1 {
3644
3646
  catch (e) {
3645
3647
  span.setStatus({
3646
3648
  code: coreTracing.SpanStatusCode.ERROR,
3647
- message: e.message
3649
+ message: e.message,
3648
3650
  });
3649
3651
  throw e;
3650
3652
  }
@@ -3659,7 +3661,7 @@ class SearchClient$1 {
3659
3661
  const payload = JSON.stringify({
3660
3662
  apiVersion: this.apiVersion,
3661
3663
  nextLink,
3662
- nextPageParameters
3664
+ nextPageParameters,
3663
3665
  });
3664
3666
  return encode(payload);
3665
3667
  }
@@ -3675,7 +3677,7 @@ class SearchClient$1 {
3675
3677
  }
3676
3678
  return {
3677
3679
  nextLink: result.nextLink,
3678
- nextPageParameters: result.nextPageParameters
3680
+ nextPageParameters: result.nextPageParameters,
3679
3681
  };
3680
3682
  }
3681
3683
  catch (e) {
@@ -3689,9 +3691,9 @@ class SearchClient$1 {
3689
3691
  operationOptions: {
3690
3692
  abortSignal,
3691
3693
  requestOptions,
3692
- tracingOptions
3694
+ tracingOptions,
3693
3695
  },
3694
- restOptions
3696
+ restOptions,
3695
3697
  };
3696
3698
  }
3697
3699
  convertSelect(select) {
@@ -3786,14 +3788,14 @@ class SearchIndexingBufferedSender {
3786
3788
  this.batchObject.upload(documents);
3787
3789
  this.emitter.emit("batchAdded", {
3788
3790
  action: "upload",
3789
- documents
3791
+ documents,
3790
3792
  });
3791
3793
  return this.internalFlush(false, updatedOptions);
3792
3794
  }
3793
3795
  catch (e) {
3794
3796
  span.setStatus({
3795
3797
  code: coreTracing.SpanStatusCode.ERROR,
3796
- message: e.message
3798
+ message: e.message,
3797
3799
  });
3798
3800
  throw e;
3799
3801
  }
@@ -3813,14 +3815,14 @@ class SearchIndexingBufferedSender {
3813
3815
  this.batchObject.merge(documents);
3814
3816
  this.emitter.emit("batchAdded", {
3815
3817
  action: "merge",
3816
- documents
3818
+ documents,
3817
3819
  });
3818
3820
  return this.internalFlush(false, updatedOptions);
3819
3821
  }
3820
3822
  catch (e) {
3821
3823
  span.setStatus({
3822
3824
  code: coreTracing.SpanStatusCode.ERROR,
3823
- message: e.message
3825
+ message: e.message,
3824
3826
  });
3825
3827
  throw e;
3826
3828
  }
@@ -3840,14 +3842,14 @@ class SearchIndexingBufferedSender {
3840
3842
  this.batchObject.mergeOrUpload(documents);
3841
3843
  this.emitter.emit("batchAdded", {
3842
3844
  action: "mergeOrUpload",
3843
- documents
3845
+ documents,
3844
3846
  });
3845
3847
  return this.internalFlush(false, updatedOptions);
3846
3848
  }
3847
3849
  catch (e) {
3848
3850
  span.setStatus({
3849
3851
  code: coreTracing.SpanStatusCode.ERROR,
3850
- message: e.message
3852
+ message: e.message,
3851
3853
  });
3852
3854
  throw e;
3853
3855
  }
@@ -3867,14 +3869,14 @@ class SearchIndexingBufferedSender {
3867
3869
  this.batchObject.delete(documents);
3868
3870
  this.emitter.emit("batchAdded", {
3869
3871
  action: "delete",
3870
- documents
3872
+ documents,
3871
3873
  });
3872
3874
  return this.internalFlush(false, updatedOptions);
3873
3875
  }
3874
3876
  catch (e) {
3875
3877
  span.setStatus({
3876
3878
  code: coreTracing.SpanStatusCode.ERROR,
3877
- message: e.message
3879
+ message: e.message,
3878
3880
  });
3879
3881
  throw e;
3880
3882
  }
@@ -3897,7 +3899,7 @@ class SearchIndexingBufferedSender {
3897
3899
  catch (e) {
3898
3900
  span.setStatus({
3899
3901
  code: coreTracing.SpanStatusCode.ERROR,
3900
- message: e.message
3902
+ message: e.message,
3901
3903
  });
3902
3904
  throw e;
3903
3905
  }
@@ -3968,7 +3970,7 @@ class SearchIndexingBufferedSender {
3968
3970
  // Cut the payload size to half
3969
3971
  const splitActionsArray = [
3970
3972
  actionsToSend.slice(0, actionsToSend.length / 2),
3971
- actionsToSend.slice(actionsToSend.length / 2, actionsToSend.length)
3973
+ actionsToSend.slice(actionsToSend.length / 2, actionsToSend.length),
3972
3974
  ];
3973
3975
  this.initialBatchActionCount = splitActionsArray[0].length; // So, we do not want 413 happening again and again
3974
3976
  for (const actions of splitActionsArray) {
@@ -10503,7 +10505,12 @@ class SearchIndexClient {
10503
10505
  /**
10504
10506
  * The API version to use when communicating with the service.
10505
10507
  */
10506
- this.apiVersion = "2020-06-30-Preview";
10508
+ this.serviceVersion = defaultServiceVersion;
10509
+ /**
10510
+ * The API version to use when communicating with the service.
10511
+ * @deprecated use {@Link serviceVersion} instead
10512
+ */
10513
+ this.apiVersion = defaultServiceVersion;
10507
10514
  this.endpoint = endpoint;
10508
10515
  this.credential = credential;
10509
10516
  this.options = options;
@@ -10526,18 +10533,25 @@ class SearchIndexClient {
10526
10533
  "OData-MaxVersion",
10527
10534
  "OData-Version",
10528
10535
  "Prefer",
10529
- "throttle-reason"
10530
- ]
10531
- }
10536
+ "throttle-reason",
10537
+ ],
10538
+ },
10532
10539
  });
10533
- let apiVersion = this.apiVersion;
10534
10540
  if (options.apiVersion) {
10535
- if (!["2020-06-30", "2021-04-30-Preview"].includes(options.apiVersion)) {
10541
+ if (!serviceVersions.includes(options.apiVersion)) {
10536
10542
  throw new Error(`Invalid Api Version: ${options.apiVersion}`);
10537
10543
  }
10538
- apiVersion = options.apiVersion;
10544
+ this.serviceVersion = options.apiVersion;
10545
+ this.apiVersion = options.apiVersion;
10546
+ }
10547
+ if (options.serviceVersion) {
10548
+ if (!serviceVersions.includes(options.serviceVersion)) {
10549
+ throw new Error(`Invalid Service Version: ${options.serviceVersion}`);
10550
+ }
10551
+ this.serviceVersion = options.serviceVersion;
10552
+ this.apiVersion = options.serviceVersion;
10539
10553
  }
10540
- this.client = new SearchServiceClient(this.endpoint, apiVersion, internalClientPipelineOptions);
10554
+ this.client = new SearchServiceClient(this.endpoint, this.serviceVersion, internalClientPipelineOptions);
10541
10555
  if (coreAuth.isTokenCredential(credential)) {
10542
10556
  this.client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_SEARCH_SCOPE }));
10543
10557
  }
@@ -10557,7 +10571,7 @@ class SearchIndexClient {
10557
10571
  catch (e) {
10558
10572
  span.setStatus({
10559
10573
  code: coreTracing.SpanStatusCode.ERROR,
10560
- message: e.message
10574
+ message: e.message,
10561
10575
  });
10562
10576
  throw e;
10563
10577
  }
@@ -10599,7 +10613,7 @@ class SearchIndexClient {
10599
10613
  },
10600
10614
  byPage: () => {
10601
10615
  return this.listIndexesPage(options);
10602
- }
10616
+ },
10603
10617
  };
10604
10618
  }
10605
10619
  listIndexesNamesPage(options = {}) {
@@ -10613,7 +10627,7 @@ class SearchIndexClient {
10613
10627
  catch (e) {
10614
10628
  span.setStatus({
10615
10629
  code: coreTracing.SpanStatusCode.ERROR,
10616
- message: e.message
10630
+ message: e.message,
10617
10631
  });
10618
10632
  throw e;
10619
10633
  }
@@ -10655,7 +10669,7 @@ class SearchIndexClient {
10655
10669
  },
10656
10670
  byPage: () => {
10657
10671
  return this.listIndexesNamesPage(options);
10658
- }
10672
+ },
10659
10673
  };
10660
10674
  }
10661
10675
  /**
@@ -10671,7 +10685,7 @@ class SearchIndexClient {
10671
10685
  catch (e) {
10672
10686
  span.setStatus({
10673
10687
  code: coreTracing.SpanStatusCode.ERROR,
10674
- message: e.message
10688
+ message: e.message,
10675
10689
  });
10676
10690
  throw e;
10677
10691
  }
@@ -10692,7 +10706,7 @@ class SearchIndexClient {
10692
10706
  catch (e) {
10693
10707
  span.setStatus({
10694
10708
  code: coreTracing.SpanStatusCode.ERROR,
10695
- message: e.message
10709
+ message: e.message,
10696
10710
  });
10697
10711
  throw e;
10698
10712
  }
@@ -10714,7 +10728,7 @@ class SearchIndexClient {
10714
10728
  catch (e) {
10715
10729
  span.setStatus({
10716
10730
  code: coreTracing.SpanStatusCode.ERROR,
10717
- message: e.message
10731
+ message: e.message,
10718
10732
  });
10719
10733
  throw e;
10720
10734
  }
@@ -10736,7 +10750,7 @@ class SearchIndexClient {
10736
10750
  catch (e) {
10737
10751
  span.setStatus({
10738
10752
  code: coreTracing.SpanStatusCode.ERROR,
10739
- message: e.message
10753
+ message: e.message,
10740
10754
  });
10741
10755
  throw e;
10742
10756
  }
@@ -10758,7 +10772,7 @@ class SearchIndexClient {
10758
10772
  catch (e) {
10759
10773
  span.setStatus({
10760
10774
  code: coreTracing.SpanStatusCode.ERROR,
10761
- message: e.message
10775
+ message: e.message,
10762
10776
  });
10763
10777
  throw e;
10764
10778
  }
@@ -10780,7 +10794,7 @@ class SearchIndexClient {
10780
10794
  catch (e) {
10781
10795
  span.setStatus({
10782
10796
  code: coreTracing.SpanStatusCode.ERROR,
10783
- message: e.message
10797
+ message: e.message,
10784
10798
  });
10785
10799
  throw e;
10786
10800
  }
@@ -10803,7 +10817,7 @@ class SearchIndexClient {
10803
10817
  catch (e) {
10804
10818
  span.setStatus({
10805
10819
  code: coreTracing.SpanStatusCode.ERROR,
10806
- message: e.message
10820
+ message: e.message,
10807
10821
  });
10808
10822
  throw e;
10809
10823
  }
@@ -10826,7 +10840,7 @@ class SearchIndexClient {
10826
10840
  catch (e) {
10827
10841
  span.setStatus({
10828
10842
  code: coreTracing.SpanStatusCode.ERROR,
10829
- message: e.message
10843
+ message: e.message,
10830
10844
  });
10831
10845
  throw e;
10832
10846
  }
@@ -10849,7 +10863,7 @@ class SearchIndexClient {
10849
10863
  catch (e) {
10850
10864
  span.setStatus({
10851
10865
  code: coreTracing.SpanStatusCode.ERROR,
10852
- message: e.message
10866
+ message: e.message,
10853
10867
  });
10854
10868
  throw e;
10855
10869
  }
@@ -10876,7 +10890,7 @@ class SearchIndexClient {
10876
10890
  catch (e) {
10877
10891
  span.setStatus({
10878
10892
  code: coreTracing.SpanStatusCode.ERROR,
10879
- message: e.message
10893
+ message: e.message,
10880
10894
  });
10881
10895
  throw e;
10882
10896
  }
@@ -10899,7 +10913,7 @@ class SearchIndexClient {
10899
10913
  catch (e) {
10900
10914
  span.setStatus({
10901
10915
  code: coreTracing.SpanStatusCode.ERROR,
10902
- message: e.message
10916
+ message: e.message,
10903
10917
  });
10904
10918
  throw e;
10905
10919
  }
@@ -10918,7 +10932,7 @@ class SearchIndexClient {
10918
10932
  const operationOptions = {
10919
10933
  abortSignal,
10920
10934
  requestOptions,
10921
- tracingOptions
10935
+ tracingOptions,
10922
10936
  };
10923
10937
  const { span, updatedOptions } = createSpan("SearchIndexClient-analyzeText", operationOptions);
10924
10938
  try {
@@ -10928,7 +10942,7 @@ class SearchIndexClient {
10928
10942
  catch (e) {
10929
10943
  span.setStatus({
10930
10944
  code: coreTracing.SpanStatusCode.ERROR,
10931
- message: e.message
10945
+ message: e.message,
10932
10946
  });
10933
10947
  throw e;
10934
10948
  }
@@ -10949,7 +10963,7 @@ class SearchIndexClient {
10949
10963
  catch (e) {
10950
10964
  span.setStatus({
10951
10965
  code: coreTracing.SpanStatusCode.ERROR,
10952
- message: e.message
10966
+ message: e.message,
10953
10967
  });
10954
10968
  throw e;
10955
10969
  }
@@ -10994,7 +11008,12 @@ class SearchIndexerClient {
10994
11008
  /**
10995
11009
  * The API version to use when communicating with the service.
10996
11010
  */
10997
- this.apiVersion = "2020-06-30-Preview";
11011
+ this.serviceVersion = defaultServiceVersion;
11012
+ /**
11013
+ * The API version to use when communicating with the service.
11014
+ * @deprecated use {@Link serviceVersion} instead
11015
+ */
11016
+ this.apiVersion = defaultServiceVersion;
10998
11017
  this.endpoint = endpoint;
10999
11018
  const libInfo = `azsdk-js-search-documents/${SDK_VERSION}`;
11000
11019
  if (!options.userAgentOptions) {
@@ -11015,18 +11034,25 @@ class SearchIndexerClient {
11015
11034
  "OData-MaxVersion",
11016
11035
  "OData-Version",
11017
11036
  "Prefer",
11018
- "throttle-reason"
11019
- ]
11020
- }
11037
+ "throttle-reason",
11038
+ ],
11039
+ },
11021
11040
  });
11022
- let apiVersion = this.apiVersion;
11023
11041
  if (options.apiVersion) {
11024
- if (!["2020-06-30", "2021-04-30-Preview"].includes(options.apiVersion)) {
11042
+ if (!serviceVersions.includes(options.apiVersion)) {
11025
11043
  throw new Error(`Invalid Api Version: ${options.apiVersion}`);
11026
11044
  }
11027
- apiVersion = options.apiVersion;
11045
+ this.serviceVersion = options.apiVersion;
11046
+ this.apiVersion = options.apiVersion;
11047
+ }
11048
+ if (options.serviceVersion) {
11049
+ if (!serviceVersions.includes(options.serviceVersion)) {
11050
+ throw new Error(`Invalid Service Version: ${options.serviceVersion}`);
11051
+ }
11052
+ this.serviceVersion = options.serviceVersion;
11053
+ this.apiVersion = options.serviceVersion;
11028
11054
  }
11029
- this.client = new SearchServiceClient(this.endpoint, apiVersion, internalClientPipelineOptions);
11055
+ this.client = new SearchServiceClient(this.endpoint, this.serviceVersion, internalClientPipelineOptions);
11030
11056
  if (coreAuth.isTokenCredential(credential)) {
11031
11057
  this.client.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_SEARCH_SCOPE }));
11032
11058
  }
@@ -11048,7 +11074,7 @@ class SearchIndexerClient {
11048
11074
  catch (e) {
11049
11075
  span.setStatus({
11050
11076
  code: coreTracing.SpanStatusCode.ERROR,
11051
- message: e.message
11077
+ message: e.message,
11052
11078
  });
11053
11079
  throw e;
11054
11080
  }
@@ -11069,7 +11095,7 @@ class SearchIndexerClient {
11069
11095
  catch (e) {
11070
11096
  span.setStatus({
11071
11097
  code: coreTracing.SpanStatusCode.ERROR,
11072
- message: e.message
11098
+ message: e.message,
11073
11099
  });
11074
11100
  throw e;
11075
11101
  }
@@ -11090,7 +11116,7 @@ class SearchIndexerClient {
11090
11116
  catch (e) {
11091
11117
  span.setStatus({
11092
11118
  code: coreTracing.SpanStatusCode.ERROR,
11093
- message: e.message
11119
+ message: e.message,
11094
11120
  });
11095
11121
  throw e;
11096
11122
  }
@@ -11111,7 +11137,7 @@ class SearchIndexerClient {
11111
11137
  catch (e) {
11112
11138
  span.setStatus({
11113
11139
  code: coreTracing.SpanStatusCode.ERROR,
11114
- message: e.message
11140
+ message: e.message,
11115
11141
  });
11116
11142
  throw e;
11117
11143
  }
@@ -11132,7 +11158,7 @@ class SearchIndexerClient {
11132
11158
  catch (e) {
11133
11159
  span.setStatus({
11134
11160
  code: coreTracing.SpanStatusCode.ERROR,
11135
- message: e.message
11161
+ message: e.message,
11136
11162
  });
11137
11163
  throw e;
11138
11164
  }
@@ -11153,7 +11179,7 @@ class SearchIndexerClient {
11153
11179
  catch (e) {
11154
11180
  span.setStatus({
11155
11181
  code: coreTracing.SpanStatusCode.ERROR,
11156
- message: e.message
11182
+ message: e.message,
11157
11183
  });
11158
11184
  throw e;
11159
11185
  }
@@ -11175,7 +11201,7 @@ class SearchIndexerClient {
11175
11201
  catch (e) {
11176
11202
  span.setStatus({
11177
11203
  code: coreTracing.SpanStatusCode.ERROR,
11178
- message: e.message
11204
+ message: e.message,
11179
11205
  });
11180
11206
  throw e;
11181
11207
  }
@@ -11197,7 +11223,7 @@ class SearchIndexerClient {
11197
11223
  catch (e) {
11198
11224
  span.setStatus({
11199
11225
  code: coreTracing.SpanStatusCode.ERROR,
11200
- message: e.message
11226
+ message: e.message,
11201
11227
  });
11202
11228
  throw e;
11203
11229
  }
@@ -11219,7 +11245,7 @@ class SearchIndexerClient {
11219
11245
  catch (e) {
11220
11246
  span.setStatus({
11221
11247
  code: coreTracing.SpanStatusCode.ERROR,
11222
- message: e.message
11248
+ message: e.message,
11223
11249
  });
11224
11250
  throw e;
11225
11251
  }
@@ -11241,7 +11267,7 @@ class SearchIndexerClient {
11241
11267
  catch (e) {
11242
11268
  span.setStatus({
11243
11269
  code: coreTracing.SpanStatusCode.ERROR,
11244
- message: e.message
11270
+ message: e.message,
11245
11271
  });
11246
11272
  throw e;
11247
11273
  }
@@ -11263,7 +11289,7 @@ class SearchIndexerClient {
11263
11289
  catch (e) {
11264
11290
  span.setStatus({
11265
11291
  code: coreTracing.SpanStatusCode.ERROR,
11266
- message: e.message
11292
+ message: e.message,
11267
11293
  });
11268
11294
  throw e;
11269
11295
  }
@@ -11285,7 +11311,7 @@ class SearchIndexerClient {
11285
11311
  catch (e) {
11286
11312
  span.setStatus({
11287
11313
  code: coreTracing.SpanStatusCode.ERROR,
11288
- message: e.message
11314
+ message: e.message,
11289
11315
  });
11290
11316
  throw e;
11291
11317
  }
@@ -11308,7 +11334,7 @@ class SearchIndexerClient {
11308
11334
  catch (e) {
11309
11335
  span.setStatus({
11310
11336
  code: coreTracing.SpanStatusCode.ERROR,
11311
- message: e.message
11337
+ message: e.message,
11312
11338
  });
11313
11339
  throw e;
11314
11340
  }
@@ -11331,7 +11357,7 @@ class SearchIndexerClient {
11331
11357
  catch (e) {
11332
11358
  span.setStatus({
11333
11359
  code: coreTracing.SpanStatusCode.ERROR,
11334
- message: e.message
11360
+ message: e.message,
11335
11361
  });
11336
11362
  throw e;
11337
11363
  }
@@ -11354,7 +11380,7 @@ class SearchIndexerClient {
11354
11380
  catch (e) {
11355
11381
  span.setStatus({
11356
11382
  code: coreTracing.SpanStatusCode.ERROR,
11357
- message: e.message
11383
+ message: e.message,
11358
11384
  });
11359
11385
  throw e;
11360
11386
  }
@@ -11381,7 +11407,7 @@ class SearchIndexerClient {
11381
11407
  catch (e) {
11382
11408
  span.setStatus({
11383
11409
  code: coreTracing.SpanStatusCode.ERROR,
11384
- message: e.message
11410
+ message: e.message,
11385
11411
  });
11386
11412
  throw e;
11387
11413
  }
@@ -11408,7 +11434,7 @@ class SearchIndexerClient {
11408
11434
  catch (e) {
11409
11435
  span.setStatus({
11410
11436
  code: coreTracing.SpanStatusCode.ERROR,
11411
- message: e.message
11437
+ message: e.message,
11412
11438
  });
11413
11439
  throw e;
11414
11440
  }
@@ -11435,7 +11461,7 @@ class SearchIndexerClient {
11435
11461
  catch (e) {
11436
11462
  span.setStatus({
11437
11463
  code: coreTracing.SpanStatusCode.ERROR,
11438
- message: e.message
11464
+ message: e.message,
11439
11465
  });
11440
11466
  throw e;
11441
11467
  }
@@ -11457,7 +11483,7 @@ class SearchIndexerClient {
11457
11483
  catch (e) {
11458
11484
  span.setStatus({
11459
11485
  code: coreTracing.SpanStatusCode.ERROR,
11460
- message: e.message
11486
+ message: e.message,
11461
11487
  });
11462
11488
  throw e;
11463
11489
  }
@@ -11478,7 +11504,7 @@ class SearchIndexerClient {
11478
11504
  catch (e) {
11479
11505
  span.setStatus({
11480
11506
  code: coreTracing.SpanStatusCode.ERROR,
11481
- message: e.message
11507
+ message: e.message,
11482
11508
  });
11483
11509
  throw e;
11484
11510
  }
@@ -11499,7 +11525,7 @@ class SearchIndexerClient {
11499
11525
  catch (e) {
11500
11526
  span.setStatus({
11501
11527
  code: coreTracing.SpanStatusCode.ERROR,
11502
- message: e.message
11528
+ message: e.message,
11503
11529
  });
11504
11530
  throw e;
11505
11531
  }
@@ -11517,13 +11543,13 @@ class SearchIndexerClient {
11517
11543
  try {
11518
11544
  await this.client.indexers.resetDocs(indexerName, Object.assign(Object.assign({}, updatedOptions), { keysOrIds: {
11519
11545
  documentKeys: updatedOptions.documentKeys,
11520
- datasourceDocumentIds: updatedOptions.datasourceDocumentIds
11546
+ datasourceDocumentIds: updatedOptions.datasourceDocumentIds,
11521
11547
  } }));
11522
11548
  }
11523
11549
  catch (e) {
11524
11550
  span.setStatus({
11525
11551
  code: coreTracing.SpanStatusCode.ERROR,
11526
- message: e.message
11552
+ message: e.message,
11527
11553
  });
11528
11554
  throw e;
11529
11555
  }
@@ -11545,7 +11571,7 @@ class SearchIndexerClient {
11545
11571
  catch (e) {
11546
11572
  span.setStatus({
11547
11573
  code: coreTracing.SpanStatusCode.ERROR,
11548
- message: e.message
11574
+ message: e.message,
11549
11575
  });
11550
11576
  throw e;
11551
11577
  }
@@ -12675,7 +12701,7 @@ async function createSynonymMapFromFile(name, filePath) {
12675
12701
  .filter(Boolean);
12676
12702
  return {
12677
12703
  name,
12678
- synonyms
12704
+ synonyms,
12679
12705
  };
12680
12706
  }
12681
12707