@coveo/push-api-client 1.6.9 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/definitions/environment.d.ts +3 -3
- package/dist/definitions/errors/privilegeError.d.ts +6 -0
- package/dist/definitions/fieldAnalyser/fieldAnalyser.d.ts +2 -10
- package/dist/definitions/fieldAnalyser/{utils.d.ts → fieldUtils.d.ts} +0 -0
- package/dist/definitions/fieldAnalyser/{utils.spec.d.ts → fieldsUtils.spec.d.ts} +0 -0
- package/dist/definitions/fieldAnalyser/inconsistencies.d.ts +1 -1
- package/dist/definitions/fieldAnalyser/typeUtils.d.ts +3 -0
- package/dist/definitions/{source.spec.d.ts → fieldAnalyser/typeUtils.spec.d.ts} +0 -0
- package/dist/definitions/help/axiosUtils.d.ts +2 -0
- package/dist/definitions/help/fileConsumer.d.ts +26 -0
- package/dist/definitions/help/fileConsumer.spec.d.ts +1 -0
- package/dist/definitions/help/fileContainer.d.ts +9 -0
- package/dist/definitions/help/fileContainer.spec.d.ts +1 -0
- package/dist/definitions/help/urlUtils.d.ts +27 -0
- package/dist/definitions/index.d.ts +6 -2
- package/dist/definitions/interfaces.d.ts +39 -0
- package/dist/definitions/source/batchUploadDocumentsFromFile.d.ts +11 -0
- package/dist/definitions/source/catalog.d.ts +69 -0
- package/dist/definitions/source/catalog.spec.d.ts +1 -0
- package/dist/definitions/source/catalog.stream.spec.d.ts +1 -0
- package/dist/definitions/source/documentUploader.d.ts +5 -0
- package/dist/definitions/{source.d.ts → source/push.d.ts} +35 -77
- package/dist/definitions/source/push.spec.d.ts +1 -0
- package/dist/definitions/source/securityIdenty.d.ts +42 -0
- package/dist/definitions/source/source.d.ts +5 -0
- package/dist/definitions/uploadStrategy/fileContainerStrategy.d.ts +23 -0
- package/dist/definitions/uploadStrategy/index.d.ts +3 -0
- package/dist/definitions/uploadStrategy/strategy.d.ts +16 -0
- package/dist/definitions/uploadStrategy/streamChunkStrategy.d.ts +27 -0
- package/dist/definitions/validation/preconditions/apiKeyPrivilege.d.ts +3 -0
- package/dist/definitions/validation/preconditions/apiKeyPrivilege.spec.d.ts +1 -0
- package/dist/definitions/validation/preconditions/platformPrivilege.d.ts +7 -0
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/AnySecurityIdentityBuilder.html +3 -3
- package/dist/docs/classes/DocumentBuilder.html +17 -17
- package/dist/docs/classes/FieldAnalyser.html +3 -3
- package/dist/docs/classes/GroupSecurityIdentityBuilder.html +3 -3
- package/dist/docs/classes/PushSource.html +43 -0
- package/dist/docs/classes/UserSecurityIdentityBuilder.html +3 -3
- package/dist/docs/classes/VirtualGroupSecurityIdentityBuilder.html +3 -3
- package/dist/docs/enums/PlatformEnvironment.html +1 -1
- package/dist/docs/enums/Region.html +1 -1
- package/dist/docs/enums/SourceVisibility.html +1 -1
- package/dist/docs/index.html +2 -2
- package/dist/docs/interfaces/BatchUpdateDocuments.html +1 -1
- package/dist/docs/interfaces/Document.html +14 -14
- package/dist/docs/interfaces/SecurityIdentity.html +4 -4
- package/dist/docs/interfaces/SecurityIdentityBuilder.html +1 -1
- package/dist/docs/interfaces/UploadBatchCallbackData.html +1 -1
- package/dist/docs/modules.html +3 -2
- package/dist/environment.js.map +1 -1
- package/dist/errors/privilegeError.js +13 -0
- package/dist/errors/privilegeError.js.map +1 -0
- package/dist/fieldAnalyser/fieldAnalyser.js +24 -62
- package/dist/fieldAnalyser/fieldAnalyser.js.map +1 -1
- package/dist/fieldAnalyser/fieldAnalyser.spec.js +28 -22
- package/dist/fieldAnalyser/fieldAnalyser.spec.js.map +1 -1
- package/dist/fieldAnalyser/{utils.js → fieldUtils.js} +5 -1
- package/dist/fieldAnalyser/fieldUtils.js.map +1 -0
- package/dist/fieldAnalyser/{utils.spec.js → fieldsUtils.spec.js} +7 -4
- package/dist/fieldAnalyser/fieldsUtils.spec.js.map +1 -0
- package/dist/fieldAnalyser/inconsistencies.js.map +1 -1
- package/dist/fieldAnalyser/typeUtils.js +39 -0
- package/dist/fieldAnalyser/typeUtils.js.map +1 -0
- package/dist/fieldAnalyser/typeUtils.spec.js +48 -0
- package/dist/fieldAnalyser/typeUtils.spec.js.map +1 -0
- package/dist/help/axiosUtils.js +12 -0
- package/dist/help/axiosUtils.js.map +1 -0
- package/dist/help/fileConsumer.js +100 -0
- package/dist/help/fileConsumer.js.map +1 -0
- package/dist/help/fileConsumer.spec.js +75 -0
- package/dist/help/fileConsumer.spec.js.map +1 -0
- package/dist/help/fileContainer.js +20 -0
- package/dist/help/fileContainer.js.map +1 -0
- package/dist/help/fileContainer.spec.js +34 -0
- package/dist/help/fileContainer.spec.js.map +1 -0
- package/dist/help/urlUtils.js +43 -0
- package/dist/help/urlUtils.js.map +1 -0
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/interfaces.js +3 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/localtest.js +2 -2
- package/dist/localtest.js.map +1 -1
- package/dist/source/batchUploadDocumentsFromFile.js +50 -0
- package/dist/source/batchUploadDocumentsFromFile.js.map +1 -0
- package/dist/source/catalog.js +115 -0
- package/dist/source/catalog.js.map +1 -0
- package/dist/source/catalog.spec.js +239 -0
- package/dist/source/catalog.spec.js.map +1 -0
- package/dist/source/catalog.stream.spec.js +189 -0
- package/dist/source/catalog.stream.spec.js.map +1 -0
- package/dist/source/documentUploader.js +23 -0
- package/dist/source/documentUploader.js.map +1 -0
- package/dist/source/push.js +199 -0
- package/dist/source/push.js.map +1 -0
- package/dist/{source.spec.js → source/push.spec.js} +44 -27
- package/dist/source/push.spec.js.map +1 -0
- package/dist/source/securityIdenty.js +59 -0
- package/dist/source/securityIdenty.js.map +1 -0
- package/dist/source/source.js +9 -0
- package/dist/source/source.js.map +1 -0
- package/dist/uploadStrategy/fileContainerStrategy.js +34 -0
- package/dist/uploadStrategy/fileContainerStrategy.js.map +1 -0
- package/dist/uploadStrategy/index.js +7 -0
- package/dist/uploadStrategy/index.js.map +1 -0
- package/dist/uploadStrategy/strategy.js +3 -0
- package/dist/uploadStrategy/strategy.js.map +1 -0
- package/dist/uploadStrategy/streamChunkStrategy.js +51 -0
- package/dist/uploadStrategy/streamChunkStrategy.js.map +1 -0
- package/dist/validation/preconditions/apiKeyPrivilege.js +21 -0
- package/dist/validation/preconditions/apiKeyPrivilege.js.map +1 -0
- package/dist/validation/preconditions/apiKeyPrivilege.spec.js +70 -0
- package/dist/validation/preconditions/apiKeyPrivilege.spec.js.map +1 -0
- package/dist/validation/preconditions/platformPrivilege.js +35 -0
- package/dist/validation/preconditions/platformPrivilege.js.map +1 -0
- package/package.json +1 -1
- package/dist/docs/classes/Source.html +0 -45
- package/dist/docs/interfaces/BatchUpdateDocumentsFromFiles.html +0 -7
- package/dist/fieldAnalyser/utils.js.map +0 -1
- package/dist/fieldAnalyser/utils.spec.js.map +0 -1
- package/dist/source.js +0 -322
- package/dist/source.js.map +0 -1
- package/dist/source.spec.js.map +0 -1
package/dist/docs/modules.html
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@coveo/push-api-client</title><meta name="description" content="Documentation for @coveo/push-api-client"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@coveo/push-api-client</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>@coveo/push-api-client</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Enumerations</h3><ul class="tsd-index-list"><li class="tsd-kind-enum"><a href="enums/PlatformEnvironment.html" class="tsd-kind-icon">Platform<wbr/>Environment</a></li><li class="tsd-kind-enum tsd-is-external"><a href="enums/Region.html" class="tsd-kind-icon">Region</a></li><li class="tsd-kind-enum tsd-is-external"><a href="enums/SourceVisibility.html" class="tsd-kind-icon">Source<wbr/>Visibility</a></li></ul></section><section class="tsd-index-section "><h3>Classes</h3><ul class="tsd-index-list"><li class="tsd-kind-class"><a href="classes/AnySecurityIdentityBuilder.html" class="tsd-kind-icon">Any<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/DocumentBuilder.html" class="tsd-kind-icon">Document<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/FieldAnalyser.html" class="tsd-kind-icon">Field<wbr/>Analyser</a></li><li class="tsd-kind-class"><a href="classes/GroupSecurityIdentityBuilder.html" class="tsd-kind-icon">Group<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/
|
1
|
+
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@coveo/push-api-client</title><meta name="description" content="Documentation for @coveo/push-api-client"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@coveo/push-api-client</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>@coveo/push-api-client</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Enumerations</h3><ul class="tsd-index-list"><li class="tsd-kind-enum"><a href="enums/PlatformEnvironment.html" class="tsd-kind-icon">Platform<wbr/>Environment</a></li><li class="tsd-kind-enum tsd-is-external"><a href="enums/Region.html" class="tsd-kind-icon">Region</a></li><li class="tsd-kind-enum tsd-is-external"><a href="enums/SourceVisibility.html" class="tsd-kind-icon">Source<wbr/>Visibility</a></li></ul></section><section class="tsd-index-section "><h3>Classes</h3><ul class="tsd-index-list"><li class="tsd-kind-class"><a href="classes/AnySecurityIdentityBuilder.html" class="tsd-kind-icon">Any<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/DocumentBuilder.html" class="tsd-kind-icon">Document<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/FieldAnalyser.html" class="tsd-kind-icon">Field<wbr/>Analyser</a></li><li class="tsd-kind-class"><a href="classes/GroupSecurityIdentityBuilder.html" class="tsd-kind-icon">Group<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/PushSource.html" class="tsd-kind-icon">Push<wbr/>Source</a></li><li class="tsd-kind-class"><a href="classes/UserSecurityIdentityBuilder.html" class="tsd-kind-icon">User<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/VirtualGroupSecurityIdentityBuilder.html" class="tsd-kind-icon">Virtual<wbr/>Group<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li></ul></section><section class="tsd-index-section "><h3>Interfaces</h3><ul class="tsd-index-list"><li class="tsd-kind-interface"><a href="interfaces/BatchUpdateDocuments.html" class="tsd-kind-icon">Batch<wbr/>Update<wbr/>Documents</a></li><li class="tsd-kind-interface"><a href="interfaces/Document.html" class="tsd-kind-icon">Document</a></li><li class="tsd-kind-interface"><a href="interfaces/SecurityIdentity.html" class="tsd-kind-icon">Security<wbr/>Identity</a></li><li class="tsd-kind-interface"><a href="interfaces/SecurityIdentityBuilder.html" class="tsd-kind-icon">Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-interface"><a href="interfaces/UploadBatchCallbackData.html" class="tsd-kind-icon">Upload<wbr/>Batch<wbr/>Callback<wbr/>Data</a></li></ul></section><section class="tsd-index-section "><h3>Type aliases</h3><ul class="tsd-index-list"><li class="tsd-kind-type-alias"><a href="modules.html#BatchUpdateDocumentsFromFiles" class="tsd-kind-icon">Batch<wbr/>Update<wbr/>Documents<wbr/>From<wbr/>Files</a></li><li class="tsd-kind-type-alias"><a href="modules.html#CompressionType" class="tsd-kind-icon">Compression<wbr/>Type</a></li><li class="tsd-kind-type-alias"><a href="modules.html#FailedUploadCallback" class="tsd-kind-icon">Failed<wbr/>Upload<wbr/>Callback</a></li><li class="tsd-kind-type-alias"><a href="modules.html#Metadata" class="tsd-kind-icon">Metadata</a></li><li class="tsd-kind-type-alias"><a href="modules.html#MetadataValue" class="tsd-kind-icon">Metadata<wbr/>Value</a></li><li class="tsd-kind-type-alias"><a href="modules.html#PlatformUrlOptions" class="tsd-kind-icon">Platform<wbr/>Url<wbr/>Options</a></li><li class="tsd-kind-type-alias"><a href="modules.html#SecurityIdentityType" class="tsd-kind-icon">Security<wbr/>Identity<wbr/>Type</a></li><li class="tsd-kind-type-alias"><a href="modules.html#SuccessfulUploadCallback" class="tsd-kind-icon">Successful<wbr/>Upload<wbr/>Callback</a></li></ul></section><section class="tsd-index-section "><h3>Variables</h3><ul class="tsd-index-list"><li class="tsd-kind-variable"><a href="modules.html#Source" class="tsd-kind-icon">Source</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Type aliases</h2><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="BatchUpdateDocumentsFromFiles" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Batch<wbr/>Update<wbr/>Documents<wbr/>From<wbr/>Files<a href="#BatchUpdateDocumentsFromFiles" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Batch<wbr/>Update<wbr/>Documents<wbr/>From<wbr/>Files<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">BatchUpdateDocumentsOptions</span><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-type">ConcurrentProcessing</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/interfaces.ts#L41">src/interfaces.ts:41</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="CompressionType" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Compression<wbr/>Type<a href="#CompressionType" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Compression<wbr/>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"UNCOMPRESSED"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"DEFLATE"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"GZIP"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"LZMA"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"ZLIB"</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/document.ts#L42">src/document.ts:42</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
2
2
|
<p>The compression type that was applied to your compressed document.</p>
|
3
|
-
</div></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="Metadata" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Metadata<a href="#Metadata" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Metadata<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><a href="modules.html#MetadataValue" class="tsd-signature-type" data-tsd-kind="Type alias">MetadataValue</a><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/9876053/src/document.ts#L37">src/document.ts:37</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="MetadataValue" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Metadata<wbr/>Value<a href="#MetadataValue" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Metadata<wbr/>Value<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/9876053/src/document.ts#L36">src/document.ts:36</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="SecurityIdentityType" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Security<wbr/>Identity<wbr/>Type<a href="#SecurityIdentityType" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Security<wbr/>Identity<wbr/>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"UNKNOWN"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"USER"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"GROUP"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"VIRTUAL_GROUP"</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/9876053/src/document.ts#L1">src/document.ts:1</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="UploadBatchCallback" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Upload<wbr/>Batch<wbr/>Callback<a href="#UploadBatchCallback" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Upload<wbr/>Batch<wbr/>Callback<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>err<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span>, data<span class="tsd-signature-symbol">: </span><a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/9876053/src/source.ts#L53">src/source.ts:53</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-type-alias"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>err<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span>, data<span class="tsd-signature-symbol">: </span><a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>err: <span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></h5></li><li><h5>data: <a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-enum"><a href="enums/PlatformEnvironment.html" class="tsd-kind-icon">Platform<wbr/>Environment</a></li><li class="tsd-kind-enum tsd-is-external"><a href="enums/Region.html" class="tsd-kind-icon">Region</a></li><li class="tsd-kind-enum tsd-is-external"><a href="enums/SourceVisibility.html" class="tsd-kind-icon">Source<wbr/>Visibility</a></li><li class="tsd-kind-class"><a href="classes/AnySecurityIdentityBuilder.html" class="tsd-kind-icon">Any<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/DocumentBuilder.html" class="tsd-kind-icon">Document<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/FieldAnalyser.html" class="tsd-kind-icon">Field<wbr/>Analyser</a></li><li class="tsd-kind-class"><a href="classes/GroupSecurityIdentityBuilder.html" class="tsd-kind-icon">Group<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/Source.html" class="tsd-kind-icon">Source</a></li><li class="tsd-kind-class"><a href="classes/UserSecurityIdentityBuilder.html" class="tsd-kind-icon">User<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/VirtualGroupSecurityIdentityBuilder.html" class="tsd-kind-icon">Virtual<wbr/>Group<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-interface"><a href="interfaces/BatchUpdateDocuments.html" class="tsd-kind-icon">Batch<wbr/>Update<wbr/>Documents</a></li><li class="tsd-kind-interface"><a href="interfaces/BatchUpdateDocumentsFromFiles.html" class="tsd-kind-icon">Batch<wbr/>Update<wbr/>Documents<wbr/>From<wbr/>Files</a></li><li class="tsd-kind-interface"><a href="interfaces/Document.html" class="tsd-kind-icon">Document</a></li><li class="tsd-kind-interface"><a href="interfaces/SecurityIdentity.html" class="tsd-kind-icon">Security<wbr/>Identity</a></li><li class="tsd-kind-interface"><a href="interfaces/SecurityIdentityBuilder.html" class="tsd-kind-icon">Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-interface"><a href="interfaces/UploadBatchCallbackData.html" class="tsd-kind-icon">Upload<wbr/>Batch<wbr/>Callback<wbr/>Data</a></li><li class="tsd-kind-type-alias"><a href="modules.html#CompressionType" class="tsd-kind-icon">Compression<wbr/>Type</a></li><li class="tsd-kind-type-alias"><a href="modules.html#Metadata" class="tsd-kind-icon">Metadata</a></li><li class="tsd-kind-type-alias"><a href="modules.html#MetadataValue" class="tsd-kind-icon">Metadata<wbr/>Value</a></li><li class="tsd-kind-type-alias"><a href="modules.html#SecurityIdentityType" class="tsd-kind-icon">Security<wbr/>Identity<wbr/>Type</a></li><li class="tsd-kind-type-alias"><a href="modules.html#UploadBatchCallback" class="tsd-kind-icon">Upload<wbr/>Batch<wbr/>Callback</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="assets/main.js"></script></body></html>
|
3
|
+
</div></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="FailedUploadCallback" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Failed<wbr/>Upload<wbr/>Callback<a href="#FailedUploadCallback" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Failed<wbr/>Upload<wbr/>Callback<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>err<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span>, value<span class="tsd-signature-symbol">: </span><a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/help/fileConsumer.ts#L13">src/help/fileConsumer.ts:13</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-type-alias"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>err<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span>, value<span class="tsd-signature-symbol">: </span><a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>err: <span class="tsd-signature-type">unknown</span></h5></li><li><h5>value: <a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="Metadata" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Metadata<a href="#Metadata" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Metadata<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><a href="modules.html#MetadataValue" class="tsd-signature-type" data-tsd-kind="Type alias">MetadataValue</a><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/document.ts#L37">src/document.ts:37</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="MetadataValue" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Metadata<wbr/>Value<a href="#MetadataValue" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Metadata<wbr/>Value<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/document.ts#L36">src/document.ts:36</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="PlatformUrlOptions" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Platform<wbr/>Url<wbr/>Options<a href="#PlatformUrlOptions" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Platform<wbr/>Url<wbr/>Options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>environment<span class="tsd-signature-symbol">?: </span><a href="enums/PlatformEnvironment.html" class="tsd-signature-type" data-tsd-kind="Enumeration">PlatformEnvironment</a><span class="tsd-signature-symbol">; </span>region<span class="tsd-signature-symbol">?: </span><a href="enums/Region.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Region</a><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/environment.ts#L14">src/environment.ts:14</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> environment<span class="tsd-signature-symbol">?: </span><a href="enums/PlatformEnvironment.html" class="tsd-signature-type" data-tsd-kind="Enumeration">PlatformEnvironment</a></h5></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> region<span class="tsd-signature-symbol">?: </span><a href="enums/Region.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Region</a></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="SecurityIdentityType" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Security<wbr/>Identity<wbr/>Type<a href="#SecurityIdentityType" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Security<wbr/>Identity<wbr/>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"UNKNOWN"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"USER"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"GROUP"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"VIRTUAL_GROUP"</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/document.ts#L1">src/document.ts:1</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="SuccessfulUploadCallback" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Successful<wbr/>Upload<wbr/>Callback<a href="#SuccessfulUploadCallback" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Successful<wbr/>Upload<wbr/>Callback<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/help/fileConsumer.ts#L12">src/help/fileConsumer.ts:12</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-type-alias"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>data: <a href="interfaces/UploadBatchCallbackData.html" class="tsd-signature-type" data-tsd-kind="Interface">UploadBatchCallbackData</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Variables</h2><section class="tsd-panel tsd-member tsd-kind-variable"><a id="Source" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> Source<a href="#Source" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Source<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">typeof </span><a href="classes/PushSource.html" class="tsd-signature-type" data-tsd-kind="Class">PushSource</a><span class="tsd-signature-symbol"> = PushSource</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/coveo/push-api-client.js/blob/c5b2bd6/src/source/source.ts#L6">src/source/source.ts:6</a></li></ul></aside><div class="tsd-comment tsd-typography"><dl class="tsd-comment-tags"><dt>deprecated</dt><dd><p>This class has been replaced by <a href="classes/PushSource.html">PushSource</a></p>
|
4
|
+
</dd></dl></div></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-enum"><a href="enums/PlatformEnvironment.html" class="tsd-kind-icon">Platform<wbr/>Environment</a></li><li class="tsd-kind-enum tsd-is-external"><a href="enums/Region.html" class="tsd-kind-icon">Region</a></li><li class="tsd-kind-enum tsd-is-external"><a href="enums/SourceVisibility.html" class="tsd-kind-icon">Source<wbr/>Visibility</a></li><li class="tsd-kind-class"><a href="classes/AnySecurityIdentityBuilder.html" class="tsd-kind-icon">Any<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/DocumentBuilder.html" class="tsd-kind-icon">Document<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/FieldAnalyser.html" class="tsd-kind-icon">Field<wbr/>Analyser</a></li><li class="tsd-kind-class"><a href="classes/GroupSecurityIdentityBuilder.html" class="tsd-kind-icon">Group<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/PushSource.html" class="tsd-kind-icon">Push<wbr/>Source</a></li><li class="tsd-kind-class"><a href="classes/UserSecurityIdentityBuilder.html" class="tsd-kind-icon">User<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-class"><a href="classes/VirtualGroupSecurityIdentityBuilder.html" class="tsd-kind-icon">Virtual<wbr/>Group<wbr/>Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-interface"><a href="interfaces/BatchUpdateDocuments.html" class="tsd-kind-icon">Batch<wbr/>Update<wbr/>Documents</a></li><li class="tsd-kind-interface"><a href="interfaces/Document.html" class="tsd-kind-icon">Document</a></li><li class="tsd-kind-interface"><a href="interfaces/SecurityIdentity.html" class="tsd-kind-icon">Security<wbr/>Identity</a></li><li class="tsd-kind-interface"><a href="interfaces/SecurityIdentityBuilder.html" class="tsd-kind-icon">Security<wbr/>Identity<wbr/>Builder</a></li><li class="tsd-kind-interface"><a href="interfaces/UploadBatchCallbackData.html" class="tsd-kind-icon">Upload<wbr/>Batch<wbr/>Callback<wbr/>Data</a></li><li class="tsd-kind-type-alias"><a href="modules.html#BatchUpdateDocumentsFromFiles" class="tsd-kind-icon">Batch<wbr/>Update<wbr/>Documents<wbr/>From<wbr/>Files</a></li><li class="tsd-kind-type-alias"><a href="modules.html#CompressionType" class="tsd-kind-icon">Compression<wbr/>Type</a></li><li class="tsd-kind-type-alias"><a href="modules.html#FailedUploadCallback" class="tsd-kind-icon">Failed<wbr/>Upload<wbr/>Callback</a></li><li class="tsd-kind-type-alias"><a href="modules.html#Metadata" class="tsd-kind-icon">Metadata</a></li><li class="tsd-kind-type-alias"><a href="modules.html#MetadataValue" class="tsd-kind-icon">Metadata<wbr/>Value</a></li><li class="tsd-kind-type-alias"><a href="modules.html#PlatformUrlOptions" class="tsd-kind-icon">Platform<wbr/>Url<wbr/>Options</a></li><li class="tsd-kind-type-alias"><a href="modules.html#SecurityIdentityType" class="tsd-kind-icon">Security<wbr/>Identity<wbr/>Type</a></li><li class="tsd-kind-type-alias"><a href="modules.html#SuccessfulUploadCallback" class="tsd-kind-icon">Successful<wbr/>Upload<wbr/>Callback</a></li><li class="tsd-kind-variable"><a href="modules.html#Source" class="tsd-kind-icon">Source</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="assets/main.js"></script></body></html>
|
package/dist/environment.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA,8DAA6D;AAC7D,4DAAgD;AAAxC,yGAAA,MAAM,OAAA;AAEd,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,kCAAW,CAAA;IACX,gCAAS,CAAA;IACT,sCAAe,CAAA;IACf,oCAAa,CAAA;AACf,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B;AAEY,QAAA,mBAAmB,GAAG,mBAAmB,CAAC,IAAa,CAAC;AACxD,QAAA,cAAc,GAAG,wBAAM,CAAC,EAAW,CAAC;AAOjD,MAAM,cAAc,GAAuB;IACzC,WAAW,EAAE,2BAAmB;IAChC,MAAM,EAAE,sBAAc;CACvB,CAAC;AAEF,SAAgB,WAAW,CAAC,
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA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2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PrivilegeError = void 0;
|
4
|
+
const baseError_1 = require("./baseError");
|
5
|
+
class PrivilegeError extends baseError_1.PushApiClientBaseError {
|
6
|
+
constructor(message) {
|
7
|
+
super(message);
|
8
|
+
this.message = message;
|
9
|
+
this.name = 'Privilege Error';
|
10
|
+
}
|
11
|
+
}
|
12
|
+
exports.PrivilegeError = PrivilegeError;
|
13
|
+
//# sourceMappingURL=privilegeError.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"privilegeError.js","sourceRoot":"","sources":["../../src/errors/privilegeError.ts"],"names":[],"mappings":";;;AAAA,2CAAmD;AAEnD,MAAa,cAAe,SAAQ,kCAAsB;IAExD,YAA0B,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QADS,YAAO,GAAP,OAAO,CAAQ;QADlC,SAAI,GAAG,iBAAiB,CAAC;IAGhC,CAAC;CACF;AALD,wCAKC"}
|
@@ -2,10 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.FieldAnalyser = void 0;
|
4
4
|
const platform_client_1 = require("@coveord/platform-client");
|
5
|
-
const
|
5
|
+
const fieldUtils_1 = require("./fieldUtils");
|
6
6
|
const fieldStore_1 = require("./fieldStore");
|
7
7
|
const inconsistencies_1 = require("./inconsistencies");
|
8
8
|
const fieldErrors_1 = require("../errors/fieldErrors");
|
9
|
+
const typeUtils_1 = require("./typeUtils");
|
10
|
+
const apiKeyPrivilege_1 = require("../validation/preconditions/apiKeyPrivilege");
|
11
|
+
const platformPrivilege_1 = require("../validation/preconditions/platformPrivilege");
|
9
12
|
/**
|
10
13
|
* Analyse documents to detect type inconsistencies and missing fields in your index.
|
11
14
|
*
|
@@ -14,7 +17,7 @@ class FieldAnalyser {
|
|
14
17
|
constructor(platformClient) {
|
15
18
|
this.platformClient = platformClient;
|
16
19
|
this.inconsistencies = new inconsistencies_1.Inconsistencies();
|
17
|
-
this.missingFields = new
|
20
|
+
this.missingFields = new fieldStore_1.FieldStore();
|
18
21
|
}
|
19
22
|
/**
|
20
23
|
* Adds a batch of document builders to the analyser
|
@@ -24,6 +27,7 @@ class FieldAnalyser {
|
|
24
27
|
* @return {*}
|
25
28
|
*/
|
26
29
|
async add(batch) {
|
30
|
+
await (0, apiKeyPrivilege_1.ensureNecessaryCoveoPrivileges)(this.platformClient, platformPrivilege_1.writeFieldsPrivilege);
|
27
31
|
const existingFields = await this.ensureExistingFields();
|
28
32
|
batch.flatMap((doc) => {
|
29
33
|
const documentMetadata = Object.entries(Object.assign({}, doc.build().metadata));
|
@@ -42,30 +46,35 @@ class FieldAnalyser {
|
|
42
46
|
* @return {*} {FieldAnalyserReport}
|
43
47
|
*/
|
44
48
|
report() {
|
45
|
-
|
46
|
-
this.
|
49
|
+
this.ensurePermanentId(this.missingFields);
|
50
|
+
this.removeInconsistentFields();
|
47
51
|
return {
|
48
|
-
fields:
|
52
|
+
fields: this.missingFields.marshal(),
|
49
53
|
inconsistencies: this.inconsistencies,
|
50
54
|
};
|
51
55
|
}
|
56
|
+
removeInconsistentFields() {
|
57
|
+
for (const fieldname of this.inconsistencies.keys()) {
|
58
|
+
this.missingFields.delete(fieldname);
|
59
|
+
}
|
60
|
+
}
|
52
61
|
storeMetadata(metadataKey, metadataValue) {
|
53
|
-
const
|
54
|
-
const
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
const fieldTypeCount = fieldTypeMap.get(metadataType);
|
59
|
-
fieldTypeMap.set(metadataType, fieldTypeCount ? fieldTypeCount + 1 : initialTypeCount);
|
62
|
+
const alreadyGuessedType = this.missingFields.get(metadataKey);
|
63
|
+
const newGuessedType = (0, typeUtils_1.getGuessedTypeFromValue)(metadataValue);
|
64
|
+
if (!alreadyGuessedType ||
|
65
|
+
(0, typeUtils_1.isValidTypeTransition)(alreadyGuessedType, newGuessedType)) {
|
66
|
+
this.missingFields.set(metadataKey, newGuessedType);
|
60
67
|
}
|
61
68
|
else {
|
62
|
-
|
63
|
-
|
69
|
+
this.inconsistencies.add(metadataKey, [
|
70
|
+
alreadyGuessedType,
|
71
|
+
newGuessedType,
|
72
|
+
]);
|
64
73
|
}
|
65
74
|
}
|
66
75
|
async ensureExistingFields() {
|
67
76
|
if (this.existingFields === undefined) {
|
68
|
-
this.existingFields = await (0,
|
77
|
+
this.existingFields = await (0, fieldUtils_1.listAllFieldsFromOrg)(this.platformClient);
|
69
78
|
}
|
70
79
|
return this.existingFields;
|
71
80
|
}
|
@@ -81,53 +90,6 @@ class FieldAnalyser {
|
|
81
90
|
fieldStore.set('permanentid', platform_client_1.FieldTypes.STRING);
|
82
91
|
}
|
83
92
|
}
|
84
|
-
getFieldTypes() {
|
85
|
-
const fieldStore = new fieldStore_1.FieldStore();
|
86
|
-
this.missingFields.forEach((fieldTypeMap, fieldName) => {
|
87
|
-
this.storePossibleTypeInconsistencies(fieldName, fieldTypeMap);
|
88
|
-
const fieldType = this.getMostProbableType(fieldTypeMap);
|
89
|
-
fieldStore.set(fieldName, fieldType);
|
90
|
-
});
|
91
|
-
return fieldStore;
|
92
|
-
}
|
93
|
-
storePossibleTypeInconsistencies(fieldName, fieldTypeMap) {
|
94
|
-
if (fieldTypeMap.size > 1) {
|
95
|
-
const fieldTypes = Array.from(fieldTypeMap.keys());
|
96
|
-
this.inconsistencies.add(fieldName, fieldTypes);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
getMostProbableType(field) {
|
100
|
-
const sortedType = Array.from(field.entries()).sort((a, b) => {
|
101
|
-
const countDiff = b[1] - a[1];
|
102
|
-
return countDiff ? countDiff : this.typeCompare(a[0], b[0]);
|
103
|
-
});
|
104
|
-
return sortedType[0][0];
|
105
|
-
}
|
106
|
-
typeCompare(field1, field2) {
|
107
|
-
const precedence = (field) => FieldAnalyser.fieldTypePrecedence.indexOf(field);
|
108
|
-
if (precedence(field1) < precedence(field2)) {
|
109
|
-
return 1;
|
110
|
-
}
|
111
|
-
if (precedence(field1) > precedence(field2)) {
|
112
|
-
return -1;
|
113
|
-
}
|
114
|
-
return 0;
|
115
|
-
}
|
116
|
-
getGuessedTypeFromValue(obj) {
|
117
|
-
switch (typeof obj) {
|
118
|
-
case 'number':
|
119
|
-
return this.getSpecificNumericType(obj);
|
120
|
-
case 'string':
|
121
|
-
return platform_client_1.FieldTypes.STRING;
|
122
|
-
default:
|
123
|
-
return platform_client_1.FieldTypes.STRING;
|
124
|
-
}
|
125
|
-
}
|
126
|
-
getSpecificNumericType(_number) {
|
127
|
-
// TODO: CDX-838 Support LONG, LONG32 and DATE types
|
128
|
-
return platform_client_1.FieldTypes.DOUBLE;
|
129
|
-
}
|
130
93
|
}
|
131
94
|
exports.FieldAnalyser = FieldAnalyser;
|
132
|
-
FieldAnalyser.fieldTypePrecedence = ['DOUBLE', 'STRING'];
|
133
95
|
//# sourceMappingURL=fieldAnalyser.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fieldAnalyser.js","sourceRoot":"","sources":["../../src/fieldAnalyser/fieldAnalyser.ts"],"names":[],"mappings":";;;AAAA,8DAAgF;AAEhF,
|
1
|
+
{"version":3,"file":"fieldAnalyser.js","sourceRoot":"","sources":["../../src/fieldAnalyser/fieldAnalyser.ts"],"names":[],"mappings":";;;AAAA,8DAAgF;AAEhF,6CAAkD;AAClD,6CAAwC;AACxC,uDAAkD;AAClD,uDAAyD;AACzD,2CAA2E;AAC3E,iFAA2F;AAC3F,qFAAmF;AAOnF;;;GAGG;AACH,MAAa,aAAa;IAKxB,YAA2B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QACvD,IAAI,CAAC,eAAe,GAAG,IAAI,iCAAe,EAAE,CAAC;QAC7C,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAU,EAAE,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,GAAG,CAAC,KAAwB;QACvC,MAAM,IAAA,gDAA8B,EAClC,IAAI,CAAC,cAAc,EACn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,cAAc,CAAC,EACzD;YACA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;SACrD;aAAM;YACL,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE;gBACpC,kBAAkB;gBAClB,cAAc;aACf,CAAC,CAAC;SACJ;IACH,CAAC;IAEO,KAAK,CAAC,oBAAoB;QAChC,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE;YACrC,IAAI,CAAC,cAAc,GAAG,MAAM,IAAA,iCAAoB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACvE;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEO,iBAAiB,CAAC,UAAsB;;QAC9C,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,cAAc,0CAAE,IAAI,CAC3C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,aAAa,CACxC,CAAC;QAEF,IAAI,WAAW,EAAE;YACf,IAAI,WAAW,CAAC,IAAI,KAAK,4BAAU,CAAC,MAAM,EAAE;gBAC1C,MAAM,IAAI,gCAAkB,CAAC,WAAW,CAAC,CAAC;aAC3C;SACF;aAAM;YACL,UAAU,CAAC,GAAG,CAAC,aAAa,EAAE,4BAAU,CAAC,MAAM,CAAC,CAAC;SAClD;IACH,CAAC;CACF;AA/FD,sCA+FC"}
|
@@ -13,7 +13,8 @@ const buildDocument = (metadata) => {
|
|
13
13
|
return doc;
|
14
14
|
};
|
15
15
|
const docWithNewFields = buildDocument({
|
16
|
-
|
16
|
+
some_integer: 100,
|
17
|
+
promo_price: 23.99,
|
17
18
|
description: 'Plumbus can generate and store vast amounts of heat, allowing it to be used for cooking, ironing or just heating the room.',
|
18
19
|
additional_info: 'Plumbus can secrete various agents from itself and has adaptive rubbing surfaces, making it useful for cleaning.',
|
19
20
|
price: 'six-and-a-half Brapples',
|
@@ -33,6 +34,7 @@ describe('FieldAnalyser', () => {
|
|
33
34
|
let analyser;
|
34
35
|
const mockedPlatformClient = jest.mocked(platform_client_1.default);
|
35
36
|
const mockedListFields = jest.fn();
|
37
|
+
const mockEvaluate = jest.fn();
|
36
38
|
const mockListFieldsWithValidPermanentId = () => {
|
37
39
|
mockedListFields
|
38
40
|
.mockResolvedValueOnce({
|
@@ -62,6 +64,7 @@ describe('FieldAnalyser', () => {
|
|
62
64
|
};
|
63
65
|
const doMockPlatformClient = () => {
|
64
66
|
mockedPlatformClient.mockImplementation(() => ({
|
67
|
+
privilegeEvaluator: { evaluate: mockEvaluate },
|
65
68
|
field: { list: mockedListFields },
|
66
69
|
}));
|
67
70
|
};
|
@@ -69,9 +72,20 @@ describe('FieldAnalyser', () => {
|
|
69
72
|
doMockPlatformClient();
|
70
73
|
});
|
71
74
|
beforeEach(() => {
|
75
|
+
mockEvaluate.mockResolvedValue({ approved: true });
|
72
76
|
mockedListFields.mockReset();
|
73
77
|
analyser = new fieldAnalyser_1.FieldAnalyser(dummyPlatformClient());
|
74
78
|
});
|
79
|
+
describe('when client is not allowed to create fields', () => {
|
80
|
+
beforeEach(async () => {
|
81
|
+
mockEvaluate.mockReset();
|
82
|
+
mockListFieldsWithValidPermanentId();
|
83
|
+
});
|
84
|
+
it('should throw an error', async () => {
|
85
|
+
mockEvaluate.mockResolvedValue({ approved: false });
|
86
|
+
await expect(analyser.add([docWithExistingFields])).rejects.toThrow();
|
87
|
+
});
|
88
|
+
});
|
75
89
|
describe('when fields from the batch already exist in the org', () => {
|
76
90
|
let report;
|
77
91
|
beforeEach(async () => {
|
@@ -94,6 +108,10 @@ describe('FieldAnalyser', () => {
|
|
94
108
|
const docBuilders = [docWithNewFields, docWithExistingFields];
|
95
109
|
const { fields } = (await analyser.add(docBuilders)).report();
|
96
110
|
expect(fields).toStrictEqual([
|
111
|
+
{
|
112
|
+
name: 'some_integer',
|
113
|
+
type: 'LONG',
|
114
|
+
},
|
97
115
|
{
|
98
116
|
name: 'promo_price',
|
99
117
|
type: 'DOUBLE',
|
@@ -135,10 +153,14 @@ describe('FieldAnalyser', () => {
|
|
135
153
|
it('should detect type inconsistencies', () => {
|
136
154
|
const inconsistenciesSet = report.inconsistencies;
|
137
155
|
expect(inconsistenciesSet.get('price')).toStrictEqual(new Set(['DOUBLE', 'STRING']));
|
138
|
-
expect(inconsistenciesSet.get('available')).toStrictEqual(new Set(['
|
156
|
+
expect(inconsistenciesSet.get('available')).toStrictEqual(new Set(['LONG', 'STRING']));
|
139
157
|
});
|
140
158
|
it('should still provide fields to create', () => {
|
141
159
|
expect(report.fields).toStrictEqual([
|
160
|
+
{
|
161
|
+
name: 'some_integer',
|
162
|
+
type: 'LONG',
|
163
|
+
},
|
142
164
|
{
|
143
165
|
name: 'promo_price',
|
144
166
|
type: 'DOUBLE',
|
@@ -151,28 +173,12 @@ describe('FieldAnalyser', () => {
|
|
151
173
|
name: 'additional_info',
|
152
174
|
type: 'STRING',
|
153
175
|
},
|
154
|
-
{
|
155
|
-
name: 'price',
|
156
|
-
type: 'STRING',
|
157
|
-
},
|
158
|
-
{
|
159
|
-
name: 'available',
|
160
|
-
type: 'DOUBLE',
|
161
|
-
},
|
162
176
|
]);
|
163
177
|
});
|
164
|
-
it('should
|
165
|
-
|
166
|
-
|
167
|
-
name
|
168
|
-
type: 'STRING',
|
169
|
-
});
|
170
|
-
});
|
171
|
-
it('should associate to a field a type with the most occurences', () => {
|
172
|
-
// In this scenario, there were 2 occurences of numeric value and 1 occurence of string value for the same metadata
|
173
|
-
expect(report.fields).toContainEqual({
|
174
|
-
name: 'available',
|
175
|
-
type: 'DOUBLE',
|
178
|
+
it('should not return fields with inconsistencies', () => {
|
179
|
+
report.fields.forEach((field) => {
|
180
|
+
expect(field.name).not.toEqual('available');
|
181
|
+
expect(field.name).not.toEqual('price');
|
176
182
|
});
|
177
183
|
});
|
178
184
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fieldAnalyser.spec.js","sourceRoot":"","sources":["../../src/fieldAnalyser/fie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ieldsFromOrg = void 0;
|
4
|
+
const apiKeyPrivilege_1 = require("../validation/preconditions/apiKeyPrivilege");
|
5
|
+
const platformPrivilege_1 = require("../validation/preconditions/platformPrivilege");
|
4
6
|
const listAllFieldsFromOrg = async (client, page = 0, fields = []) => {
|
7
|
+
await (0, apiKeyPrivilege_1.ensureNecessaryCoveoPrivileges)(client, platformPrivilege_1.readFieldsPrivilege);
|
5
8
|
const list = await client.field.list({
|
6
9
|
page,
|
7
10
|
perPage: 1000,
|
@@ -14,10 +17,11 @@ const listAllFieldsFromOrg = async (client, page = 0, fields = []) => {
|
|
14
17
|
};
|
15
18
|
exports.listAllFieldsFromOrg = listAllFieldsFromOrg;
|
16
19
|
const createFields = async (client, fields, fieldBatch = 500) => {
|
20
|
+
await (0, apiKeyPrivilege_1.ensureNecessaryCoveoPrivileges)(client, platformPrivilege_1.writeFieldsPrivilege);
|
17
21
|
for (let i = 0; i < fields.length; i += fieldBatch) {
|
18
22
|
const batch = fields.slice(i, fieldBatch + i);
|
19
23
|
await client.field.createFields(batch);
|
20
24
|
}
|
21
25
|
};
|
22
26
|
exports.createFields = createFields;
|
23
|
-
//# sourceMappingURL=
|
27
|
+
//# sourceMappingURL=fieldUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fieldUtils.js","sourceRoot":"","sources":["../../src/fieldAnalyser/fieldUtils.ts"],"names":[],"mappings":";;;AACA,iFAA2F;AAC3F,qFAGuD;AAEhD,MAAM,oBAAoB,GAAG,KAAK,EACvC,MAAsB,EACtB,IAAI,GAAG,CAAC,EACR,SAAuB,EAAE,EACF,EAAE;IACzB,MAAM,IAAA,gDAA8B,EAAC,MAAM,EAAE,uCAAmB,CAAC,CAAC;IAClE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QACnC,IAAI;QACJ,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAE3B,IAAI,IAAI,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE;QAC9B,OAAO,IAAA,4BAAoB,EAAC,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;KACvD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B;AAEK,MAAM,YAAY,GAAG,KAAK,EAC/B,MAAsB,EACtB,MAAoB,EACpB,UAAU,GAAG,GAAG,EAChB,EAAE;IACF,MAAM,IAAA,gDAA8B,EAAC,MAAM,EAAE,wCAAoB,CAAC,CAAC;IACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,UAAU,EAAE;QAClD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QAC9C,MAAM,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;KACxC;AACH,CAAC,CAAC;AAVW,QAAA,YAAY,gBAUvB"}
|
@@ -2,15 +2,17 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
jest.mock('@coveord/platform-client');
|
4
4
|
const platform_client_1 = require("@coveord/platform-client");
|
5
|
-
const
|
5
|
+
const fieldUtils_1 = require("./fieldUtils");
|
6
6
|
const mockedPlatformClient = jest.mocked(platform_client_1.default);
|
7
7
|
const mockedCreateField = jest.fn();
|
8
8
|
const mockedListFields = jest.fn();
|
9
|
+
const mockEvaluate = jest.fn();
|
9
10
|
const dummyPlatformClient = () => {
|
10
11
|
return new platform_client_1.default({ accessToken: 'xxx' });
|
11
12
|
};
|
12
13
|
const doMockPlatformClient = () => {
|
13
14
|
mockedPlatformClient.mockImplementation(() => ({
|
15
|
+
privilegeEvaluator: { evaluate: mockEvaluate },
|
14
16
|
field: {
|
15
17
|
createFields: mockedCreateField,
|
16
18
|
list: mockedListFields,
|
@@ -24,6 +26,7 @@ describe('fieldUtils', () => {
|
|
24
26
|
});
|
25
27
|
beforeEach(async () => {
|
26
28
|
client = dummyPlatformClient();
|
29
|
+
mockEvaluate.mockResolvedValue({ approved: true });
|
27
30
|
});
|
28
31
|
describe('when listing fields', () => {
|
29
32
|
beforeEach(async () => {
|
@@ -36,7 +39,7 @@ describe('fieldUtils', () => {
|
|
36
39
|
items: [{ name: 'type' }],
|
37
40
|
totalPages: 2,
|
38
41
|
});
|
39
|
-
await (0,
|
42
|
+
await (0, fieldUtils_1.listAllFieldsFromOrg)(client);
|
40
43
|
});
|
41
44
|
it('should list all fields from org', async () => {
|
42
45
|
expect(mockedListFields).toHaveBeenCalledTimes(2);
|
@@ -68,7 +71,7 @@ describe('fieldUtils', () => {
|
|
68
71
|
batches: [['field1', 'field2', 'field3', 'field4', 'field5', 'field6']],
|
69
72
|
},
|
70
73
|
])('should split fields into smaller batches', async ({ batchLimit, batches }) => {
|
71
|
-
await (0,
|
74
|
+
await (0, fieldUtils_1.createFields)(client, fields, batchLimit);
|
72
75
|
expect(mockedCreateField).toHaveBeenCalledTimes(batches.length);
|
73
76
|
batches.forEach((batch, index) => {
|
74
77
|
const field = batch.map((f) => ({
|
@@ -79,4 +82,4 @@ describe('fieldUtils', () => {
|
|
79
82
|
});
|
80
83
|
});
|
81
84
|
});
|
82
|
-
//# sourceMappingURL=
|
85
|
+
//# sourceMappingURL=fieldsUtils.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fieldsUtils.spec.js","sourceRoot":"","sources":["../../src/fieldAnalyser/fieldsUtils.spec.ts"],"names":[],"mappings":";;AAAA,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;AAEtC,8DAAoE;AACpE,6CAAgE;AAEhE,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,yBAAc,CAAC,CAAC;AACzD,MAAM,iBAAiB,GAAG,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AAC,iBAAiB,CAAC,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAChE,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC9B,IAAI,EAAE,CAAC;iBACR,CAAC,CAAC,CAAC;gBACJ,MAAM,CAAC,iBAAiB,CAAC,CAAC,uBAAuB,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"inconsistencies.js","sourceRoot":"","sources":["../../src/fieldAnalyser/inconsistencies.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAgB,SAAQ,
|
1
|
+
{"version":3,"file":"inconsistencies.js","sourceRoot":"","sources":["../../src/fieldAnalyser/inconsistencies.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAgB,SAAQ,GAA4B;IAC/D;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAEM,GAAG,CAAC,SAAiB,EAAE,KAAmB;QAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QAC/C,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,CAAa,CAAC,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAVD,0CAUC"}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getGuessedTypeFromValue = exports.isValidTypeTransition = void 0;
|
4
|
+
const platform_client_1 = require("@coveord/platform-client");
|
5
|
+
const acceptedTransitions = [
|
6
|
+
{ from: platform_client_1.FieldTypes.LONG, to: [platform_client_1.FieldTypes.LONG_64, platform_client_1.FieldTypes.DOUBLE] },
|
7
|
+
{ from: platform_client_1.FieldTypes.LONG_64, to: [platform_client_1.FieldTypes.DOUBLE] },
|
8
|
+
];
|
9
|
+
function isValidTypeTransition(currentState, nextState) {
|
10
|
+
var _a;
|
11
|
+
if (currentState === nextState) {
|
12
|
+
return true;
|
13
|
+
}
|
14
|
+
const differentStateTransition = (_a = acceptedTransitions
|
15
|
+
.find((a) => a.from === currentState)) === null || _a === void 0 ? void 0 : _a.to.includes(nextState);
|
16
|
+
return Boolean(differentStateTransition);
|
17
|
+
}
|
18
|
+
exports.isValidTypeTransition = isValidTypeTransition;
|
19
|
+
function getGuessedTypeFromValue(obj) {
|
20
|
+
switch (typeof obj) {
|
21
|
+
case 'number':
|
22
|
+
return getSpecificNumericType(obj);
|
23
|
+
case 'string':
|
24
|
+
return platform_client_1.FieldTypes.STRING;
|
25
|
+
default:
|
26
|
+
return platform_client_1.FieldTypes.STRING;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
exports.getGuessedTypeFromValue = getGuessedTypeFromValue;
|
30
|
+
function getSpecificNumericType(number) {
|
31
|
+
const is32BitInteger = (x) => (x | 0) === x;
|
32
|
+
if (Number.isInteger(number)) {
|
33
|
+
return is32BitInteger(number) ? platform_client_1.FieldTypes.LONG : platform_client_1.FieldTypes.LONG_64;
|
34
|
+
}
|
35
|
+
else {
|
36
|
+
return platform_client_1.FieldTypes.DOUBLE;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
//# sourceMappingURL=typeUtils.js.map
|