├── .editorconfig ├── .github └── workflows │ └── RavenClient.yml ├── .gitignore ├── .mocharc.jsonc ├── .tshy ├── build.json ├── commonjs.json └── esm.json ├── LICENSE ├── README.md ├── eslint.config.js ├── package-lock.json ├── package.json ├── register.js ├── scripts ├── checkImports.cjs ├── checkImports.mjs ├── clearGlobalExports.js └── reportMissingTopLevelExports.js ├── src ├── Auth │ ├── AuthOptions.ts │ └── Certificate.ts ├── Constants.ts ├── Documents │ ├── Attachments │ │ └── index.ts │ ├── BulkInsert │ │ ├── BulkInsertOperationBase.ts │ │ ├── BulkInsertOptions.ts │ │ ├── BulkInsertWriter.ts │ │ └── BulkInsertWriterBase.ts │ ├── BulkInsertOperation.ts │ ├── Changes │ │ ├── AggressiveCacheChange.ts │ │ ├── ChangesObservable.ts │ │ ├── ChangesSupportedFeatures.ts │ │ ├── CounterChange.ts │ │ ├── DatabaseChange.ts │ │ ├── DatabaseChanges.ts │ │ ├── DatabaseChangesOptions.ts │ │ ├── DatabaseConnectionState.ts │ │ ├── DocumentChange.ts │ │ ├── IChangesConnectionState.ts │ │ ├── IChangesObservable.ts │ │ ├── IConnectableChanges.ts │ │ ├── ICounterChanges.ts │ │ ├── IDatabaseChanges.ts │ │ ├── IDocumentChanges.ts │ │ ├── IIndexChanges.ts │ │ ├── IOperationChanges.ts │ │ ├── ITimeSeriesChanges.ts │ │ ├── IndexChange.ts │ │ ├── OperationStatusChange.ts │ │ └── TimeSeriesChange.ts │ ├── Commands │ │ ├── AbstractQueryCommand.ts │ │ ├── Batches │ │ │ ├── BatchOptions.ts │ │ │ ├── BatchPatchCommandData.ts │ │ │ ├── ClusterWideBatchCommand.ts │ │ │ ├── CopyAttachmentCommandData.ts │ │ │ ├── CopyTimeSeriesCommandData.ts │ │ │ ├── CountersBatchCommandData.ts │ │ │ ├── DeleteAttachmentCommandData.ts │ │ │ ├── DeleteCompareExchangeCommandData.ts │ │ │ ├── ForceRevisionCommandData.ts │ │ │ ├── IncrementalTimeSeriesBatchCommandData.ts │ │ │ ├── MoveAttachmentCommandData.ts │ │ │ ├── PatchCommandData.ts │ │ │ ├── PutAttachmentCommandData.ts │ │ │ ├── PutAttachmentCommandHelper.ts │ │ │ ├── PutCompareExchangeCommandData.ts │ │ │ ├── ShardedBatchOptions.ts │ │ │ ├── SingleNodeBatchCommand.ts │ │ │ ├── TimeSeriesBatchCommandData.ts │ │ │ └── TimeSeriesCommandData.ts │ │ ├── CommandData.ts │ │ ├── ConditionalGetDocumentsCommand.ts │ │ ├── CreateSubscriptionCommand.ts │ │ ├── DeleteDocumentCommand.ts │ │ ├── DeleteSubscriptionCommand.ts │ │ ├── DocumentSizeDetails.ts │ │ ├── DropSubscriptionConnectionCommand.ts │ │ ├── ExplainQueryCommand.ts │ │ ├── FacetQueryCommand.ts │ │ ├── GetConflictsCommand.ts │ │ ├── GetConflictsResult.ts │ │ ├── GetDocumentsCommand.ts │ │ ├── GetNextOperationIdCommand.ts │ │ ├── GetRevisionsBinEntryCommand.ts │ │ ├── GetRevisionsCommand.ts │ │ ├── GetSubscriptionStateCommand.ts │ │ ├── GetSubscriptionsCommand.ts │ │ ├── GetTcpInfoForRemoteTaskCommand.ts │ │ ├── HeadAttachmentCommand.ts │ │ ├── HeadDocumentCommand.ts │ │ ├── KillOperationCommand.ts │ │ ├── KillServerOperationCommand.ts │ │ ├── MultiGet │ │ │ ├── GetRequest.ts │ │ │ ├── GetResponse.ts │ │ │ └── MultiGetCommand.ts │ │ ├── NextIdentityForCommand.ts │ │ ├── PutDocumentCommand.ts │ │ ├── QueryCommand.ts │ │ ├── QueryStreamCommand.ts │ │ ├── SeedIdentityForCommand.ts │ │ ├── StreamCommand.ts │ │ ├── StreamResult.ts │ │ ├── StreamResultResponse.ts │ │ └── UpdateSubscriptionCommand.ts │ ├── Conventions │ │ ├── BulkInsertConventions.ts │ │ ├── DocumentConventions.ts │ │ └── ShardingConventions.ts │ ├── DataArchival │ │ └── ArchivedDataProcessingBehavior.ts │ ├── DocumentAbstractions.ts │ ├── DocumentStore.ts │ ├── DocumentStoreBase.ts │ ├── IDocumentStore.ts │ ├── IdTypeAndName.ts │ ├── Identity │ │ ├── Commands │ │ │ ├── HiloReturnCommand.ts │ │ │ └── NextHiloCommand.ts │ │ ├── GenerateEntityIdOnTheClient.ts │ │ ├── HiloDocument.ts │ │ ├── HiloIdGenerator.ts │ │ ├── HiloRangeValue.ts │ │ ├── IHiLoIdGenerator.ts │ │ ├── MultiDatabaseHiLoIdGenerator.ts │ │ ├── MultiTypeHiLoIdGenerator.ts │ │ └── NextId.ts │ ├── Indexes │ │ ├── AbstractCommonApiForIndexes.ts │ │ ├── AbstractCsharpIndexCreationTask.ts │ │ ├── AbstractCsharpMultiMapIndexCreationTask.ts │ │ ├── AbstractGenericIndexCreationTask.ts │ │ ├── AbstractIndexCreationTaskBase.ts │ │ ├── AbstractIndexDefinitionBuilder.ts │ │ ├── AbstractJavaScriptIndexCreationTask.ts │ │ ├── AbstractJavaScriptMultiMapIndexCreationTask.ts │ │ ├── AbstractRawJavaScriptIndexCreationTask.ts │ │ ├── AdditionalAssembly.ts │ │ ├── Analysis │ │ │ └── AnalyzerDefinition.ts │ │ ├── AutoIndexDefinition.ts │ │ ├── AutoIndexFieldOptions.ts │ │ ├── BaseJavaScriptIndexCreationTask.ts │ │ ├── Counters │ │ │ ├── AbstractCsharpCountersIndexCreationTask.ts │ │ │ ├── AbstractGenericCountersIndexCreationTask.ts │ │ │ ├── AbstractMultiMapCountersIndexCreationTask.ts │ │ │ ├── AbstractRawJavaScriptCountersIndexCreationTask.ts │ │ │ ├── CountersIndexDefinition.ts │ │ │ └── CountersIndexDefinitionBuilder.ts │ │ ├── Enums.ts │ │ ├── Errors.ts │ │ ├── IAbstractIndexCreationTask.ts │ │ ├── IndexCreation.ts │ │ ├── IndexDefinition.ts │ │ ├── IndexDefinitionBase.ts │ │ ├── IndexDefinitionHelper.ts │ │ ├── IndexDeploymentMode.ts │ │ ├── IndexFieldOptions.ts │ │ ├── IndexSourceType.ts │ │ ├── IndexStats.ts │ │ ├── IndexTypeExtensions.ts │ │ ├── IndexingStatus.ts │ │ ├── LuceneIndexInputType.ts │ │ ├── RollingIndex.ts │ │ ├── RollingIndexDeployment.ts │ │ ├── RollingIndexState.ts │ │ ├── Spatial.ts │ │ ├── Spatial │ │ │ └── AutoSpatialOptions.ts │ │ ├── StronglyTyped.ts │ │ ├── TimeSeries │ │ │ ├── AbstractCsharpTimeSeriesIndexCreationTask.ts │ │ │ ├── AbstractGenericTimeSeriesIndexCreationTask.ts │ │ │ ├── AbstractMultiMapTimeSeriesIndexCreationTask.ts │ │ │ ├── AbstractRawJavaScriptTimeSeriesIndexCreationTask.ts │ │ │ ├── TimeSeriesIndexDefinition.ts │ │ │ └── TimeSeriesIndexDefinitionBuilder.ts │ │ └── index.ts │ ├── Lazy.ts │ ├── Operations │ │ ├── AbstractDatabaseStatistics.ts │ │ ├── Analyzers │ │ │ ├── DeleteAnalyzerOperation.ts │ │ │ └── PutAnalyzersOperation.ts │ │ ├── Attachments │ │ │ ├── AttachmentRequest.ts │ │ │ ├── DeleteAttachmentOperation.ts │ │ │ ├── GetAttachmentOperation.ts │ │ │ └── PutAttachmentOperation.ts │ │ ├── Backups │ │ │ ├── AbstractGetPeriodicBackupStatusOperationResult.ts │ │ │ ├── AmazonSettings.ts │ │ │ ├── AzureSettings.ts │ │ │ ├── BackupConfiguration.ts │ │ │ ├── BackupEncryptionSettings.ts │ │ │ ├── BackupSettings.ts │ │ │ ├── BackupStatus.ts │ │ │ ├── BackupTaskType.ts │ │ │ ├── CompressionLevel.ts │ │ │ ├── DelayBackupOperation.ts │ │ │ ├── Enums.ts │ │ │ ├── FtpSettings.ts │ │ │ ├── GetBackupConfigurationScript.ts │ │ │ ├── GetPeriodicBackupStatusOperation.ts │ │ │ ├── GetPeriodicBackupStatusOperationResult.ts │ │ │ ├── GlacierSettings.ts │ │ │ ├── GoogleCloudSettings.ts │ │ │ ├── LastRaftIndex.ts │ │ │ ├── LocalSettings.ts │ │ │ ├── PeriodicBackupConfiguration.ts │ │ │ ├── PeriodicBackupStatus.ts │ │ │ ├── RestoreBackupConfiguration.ts │ │ │ ├── RestoreBackupConfigurationBase.ts │ │ │ ├── RestoreBackupOperation.ts │ │ │ ├── RestoreFromAzureConfiguration.ts │ │ │ ├── RestoreFromGoogleCloudConfiguration.ts │ │ │ ├── RestoreFromS3Configuration.ts │ │ │ ├── RestoreType.ts │ │ │ ├── RetentionPolicy.ts │ │ │ ├── S3Settings.ts │ │ │ ├── Sharding │ │ │ │ ├── GetShardedPeriodicBackupStatusOperation.ts │ │ │ │ ├── ShardedRestoreSettings.ts │ │ │ │ └── SingleShardRestoreSetting.ts │ │ │ ├── StartBackupOperation.ts │ │ │ ├── StartBackupOperationResult.ts │ │ │ ├── UpdatePeriodicBackupOperation.ts │ │ │ ├── UpdatePeriodicBackupOperationResult.ts │ │ │ ├── UploadProgress.ts │ │ │ └── UploadState.ts │ │ ├── BulkInsertProgress.ts │ │ ├── CollectionDetails.ts │ │ ├── CollectionStatistics.ts │ │ ├── CompactDatabaseOperation.ts │ │ ├── CompareExchange │ │ │ ├── CompareExchangeResult.ts │ │ │ ├── CompareExchangeSessionValue.ts │ │ │ ├── CompareExchangeValue.ts │ │ │ ├── CompareExchangeValueJsonConverter.ts │ │ │ ├── CompareExchangeValueResultParser.ts │ │ │ ├── CompareExchangeValueState.ts │ │ │ ├── DeleteCompareExchangeValueOperation.ts │ │ │ ├── GetCompareExchangeValueOperation.ts │ │ │ ├── GetCompareExchangeValuesOperation.ts │ │ │ ├── ICompareExchangeValue.ts │ │ │ └── PutCompareExchangeValueOperation.ts │ │ ├── Configuration │ │ │ ├── ClientConfiguration.ts │ │ │ ├── GetClientConfigurationOperation.ts │ │ │ ├── PutClientConfigurationOperation.ts │ │ │ ├── StudioConfiguration.ts │ │ │ └── StudioEnvironment.ts │ │ ├── ConnectionStrings │ │ │ ├── GetConnectionStringsOperation.ts │ │ │ ├── PutConnectionStringOperation.ts │ │ │ └── RemoveConnectionStringOperation.ts │ │ ├── Counters │ │ │ ├── CounterBatch.ts │ │ │ ├── CounterBatchOperation.ts │ │ │ ├── CounterDetail.ts │ │ │ ├── CounterOperation.ts │ │ │ ├── CounterOperationType.ts │ │ │ ├── CountersDetail.ts │ │ │ ├── DocumentCountersOperation.ts │ │ │ └── GetCountersOperation.ts │ │ ├── DataArchival │ │ │ ├── ConfigureDataArchivalOperation.ts │ │ │ ├── ConfigureDataArchivalOperationResult.ts │ │ │ └── DataArchivalConfiguration.ts │ │ ├── DatabaseHealthCheckOperation.ts │ │ ├── DatabaseStatistics.ts │ │ ├── DeleteByQueryOperation.ts │ │ ├── DetailedCollectionStatistics.ts │ │ ├── DetailedDatabaseStatistics.ts │ │ ├── DisableDatabaseToggleResult.ts │ │ ├── EssentialDatabaseStatistics.ts │ │ ├── EssentialIndexInformation.ts │ │ ├── Etl │ │ │ ├── AddEtlOperation.ts │ │ │ ├── ConnectionString.ts │ │ │ ├── ElasticSearch │ │ │ │ ├── ElasticSearchEtlConfiguration.ts │ │ │ │ └── ElasticSearchIndex.ts │ │ │ ├── EtlConfiguration.ts │ │ │ ├── Olap │ │ │ │ ├── OlapEtlConfiguration.ts │ │ │ │ ├── OlapEtlFileFormat.ts │ │ │ │ └── OlapEtlTable.ts │ │ │ ├── Queue │ │ │ │ ├── EtlQueue.ts │ │ │ │ ├── KafkaConnectionSettings.ts │ │ │ │ ├── QueueEtlConfiguration.ts │ │ │ │ └── RabbitMqConnectionSettings.ts │ │ │ ├── RavenEtlConfiguration.ts │ │ │ ├── ResetEtlOperation.ts │ │ │ ├── Sql │ │ │ │ ├── SqlEtlConfiguration.ts │ │ │ │ └── SqlEtlTable.ts │ │ │ ├── Transformation.ts │ │ │ └── UpdateEtlOperation.ts │ │ ├── Expiration │ │ │ ├── ConfigureExpirationOperation.ts │ │ │ └── ExpirationConfiguration.ts │ │ ├── GetCollectionStatisticsOperation.ts │ │ ├── GetDetailedCollectionStatisticsOperation.ts │ │ ├── GetDetailedStatisticsOperation.ts │ │ ├── GetEssentialStatisticsOperation.ts │ │ ├── GetOngoingTaskInfoOperation.ts │ │ ├── GetOperationStateOperation.ts │ │ ├── GetServerWideBackupConfigurationsResponse.ts │ │ ├── GetServerWideExternalReplicationsResponse.ts │ │ ├── GetStatisticsOperation.ts │ │ ├── IOperationProgress.ts │ │ ├── IOperationResult.ts │ │ ├── IShardedOperationProgress.ts │ │ ├── Identities │ │ │ ├── GetIdentitiesOperation.ts │ │ │ ├── NextIdentityForOperation.ts │ │ │ └── SeedIdentityForOperation.ts │ │ ├── IndexInformation.ts │ │ ├── IndexOptimizeResult.ts │ │ ├── Indexes │ │ │ ├── DeleteIndexErrorsOperation.ts │ │ │ ├── DeleteIndexOperation.ts │ │ │ ├── DisableIndexOperation.ts │ │ │ ├── EnableIndexOperation.ts │ │ │ ├── GetIndexErrorsOperation.ts │ │ │ ├── GetIndexNamesOperation.ts │ │ │ ├── GetIndexOperation.ts │ │ │ ├── GetIndexStatisticsOperation.ts │ │ │ ├── GetIndexesOperation.ts │ │ │ ├── GetIndexesStatisticsOperation.ts │ │ │ ├── GetIndexingStatusOperation.ts │ │ │ ├── GetTermsOperation.ts │ │ │ ├── IndexHasChangedOperation.ts │ │ │ ├── PutIndexesOperation.ts │ │ │ ├── ResetIndexOperation.ts │ │ │ ├── SetIndexesLockOperation.ts │ │ │ ├── SetIndexesPriorityOperation.ts │ │ │ ├── StartIndexOperation.ts │ │ │ ├── StartIndexingOperation.ts │ │ │ ├── StopIndexOperation.ts │ │ │ └── StopIndexingOperation.ts │ │ ├── MaintenanceOperationExecutor.ts │ │ ├── OngoingTasks │ │ │ ├── DeleteOngoingTaskOperation.ts │ │ │ ├── GetPullReplicationHubTasksInfoOperation.ts │ │ │ ├── NextBackup.ts │ │ │ ├── OngoingTask.ts │ │ │ ├── OngoingTaskPullReplicationAsHub.ts │ │ │ ├── OngoingTaskPullReplicationAsSink.ts │ │ │ ├── OngoingTaskType.ts │ │ │ ├── RunningBackup.ts │ │ │ └── ToggleOngoingTaskStateOperation.ts │ │ ├── OperationAbstractions.ts │ │ ├── OperationCompletionAwaiter.ts │ │ ├── OperationExecutor.ts │ │ ├── PatchByQueryOperation.ts │ │ ├── PatchOperation.ts │ │ ├── PatchRequest.ts │ │ ├── PatchResult.ts │ │ ├── PatchResultBase.ts │ │ ├── PatchStatus.ts │ │ ├── QueueSink │ │ │ ├── AddQueueSinkOperation.ts │ │ │ ├── AddQueueSinkOperationResult.ts │ │ │ ├── QueueSinkConfiguration.ts │ │ │ ├── QueueSinkProcessState.ts │ │ │ ├── QueueSinkScript.ts │ │ │ ├── UpdateQueueSinkOperation.ts │ │ │ └── UpdateQueueSinkOperationResult.ts │ │ ├── Refresh │ │ │ ├── ConfigureRefreshOperation.ts │ │ │ ├── ConfigureRefreshOperationResult.ts │ │ │ └── RefreshConfiguration.ts │ │ ├── Replication │ │ │ ├── DetailedReplicationHubAccess.ts │ │ │ ├── GetReplicationHubAccessOperation.ts │ │ │ ├── IExternalReplication.ts │ │ │ ├── PreventDeletionsMode.ts │ │ │ ├── PullReplicationAsSink.ts │ │ │ ├── PullReplicationDefinition.ts │ │ │ ├── PullReplicationDefinitionAndCurrentConnections.ts │ │ │ ├── PullReplicationMode.ts │ │ │ ├── PutPullReplicationAsHubOperation.ts │ │ │ ├── RegisterReplicationHubAccessOperation.ts │ │ │ ├── ReplicationHubAccess.ts │ │ │ ├── ReplicationHubAccessResponse.ts │ │ │ ├── ReplicationHubAccessResult.ts │ │ │ ├── UnregisterReplicationHubAccessOperation.ts │ │ │ ├── UpdateExternalReplicationOperation.ts │ │ │ └── UpdatePullReplicationAsSinkOperation.ts │ │ ├── Revisions │ │ │ ├── ConfigureRevisionsOperation.ts │ │ │ ├── EnforceRevisionsConfigurationOperation.ts │ │ │ ├── GetRevisionsOperation.ts │ │ │ └── RevisionsResult.ts │ │ ├── RevisionsCollectionConfiguration.ts │ │ ├── RevisionsConfiguration.ts │ │ ├── ServerOperationExecutor.ts │ │ ├── SessionOperationExecutor.ts │ │ ├── Sorters │ │ │ ├── DeleteSorterOperation.ts │ │ │ └── PutSortersOperation.ts │ │ ├── TimeSeries │ │ │ ├── AbstractTimeSeriesRange.ts │ │ │ ├── AggregationType.ts │ │ │ ├── ConfigureRawTimeSeriesPolicyOperation.ts │ │ │ ├── ConfigureTimeSeriesOperation.ts │ │ │ ├── ConfigureTimeSeriesOperationResult.ts │ │ │ ├── ConfigureTimeSeriesPolicyOperation.ts │ │ │ ├── ConfigureTimeSeriesValueNamesOperation.ts │ │ │ ├── GetMultipleTimeSeriesOperation.ts │ │ │ ├── GetTimeSeriesOperation.ts │ │ │ ├── GetTimeSeriesStatisticsOperation.ts │ │ │ ├── RawTimeSeriesPolicy.ts │ │ │ ├── RawTimeSeriesTypes.ts │ │ │ ├── RemoveTimeSeriesPolicyOperation.ts │ │ │ ├── TimeSeriesBatchOperation.ts │ │ │ ├── TimeSeriesCollectionConfiguration.ts │ │ │ ├── TimeSeriesConfiguration.ts │ │ │ ├── TimeSeriesCountRange.ts │ │ │ ├── TimeSeriesDetails.ts │ │ │ ├── TimeSeriesItemDetail.ts │ │ │ ├── TimeSeriesOperation.ts │ │ │ ├── TimeSeriesPolicy.ts │ │ │ ├── TimeSeriesRange.ts │ │ │ ├── TimeSeriesRangeResult.ts │ │ │ ├── TimeSeriesRangeType.ts │ │ │ ├── TimeSeriesStatistics.ts │ │ │ └── TimeSeriesTimeRange.ts │ │ ├── ToggleDatabasesStateOperation.ts │ │ └── TransactionsRecording │ │ │ ├── StartTransactionsRecordingOperation.ts │ │ │ └── StopTransactionsRecordingOperation.ts │ ├── Queries │ │ ├── Explanation │ │ │ ├── ExplanationOptions.ts │ │ │ └── Explanations.ts │ │ ├── Facets │ │ │ ├── AggregationDocumentQuery.ts │ │ │ ├── AggregationQueryBase.ts │ │ │ ├── AggregationRawDocumentQuery.ts │ │ │ ├── Facet.ts │ │ │ ├── FacetAggregationField.ts │ │ │ ├── FacetBase.ts │ │ │ ├── FacetBuilder.ts │ │ │ ├── FacetSetup.ts │ │ │ ├── GenericRangeFacet.ts │ │ │ ├── IAggregationDocumentQuery.ts │ │ │ ├── IFacetBuilder.ts │ │ │ ├── IFacetOperations.ts │ │ │ ├── IFacetOperationsBase.ts │ │ │ ├── RangeBuilder.ts │ │ │ ├── RangeFacet.ts │ │ │ └── index.ts │ │ ├── FilterFactory.ts │ │ ├── GenericQueryResult.ts │ │ ├── GroupBy.ts │ │ ├── GroupByMethod.ts │ │ ├── HashCalculator.ts │ │ ├── Highlighting │ │ │ ├── HighlightingOptions.ts │ │ │ ├── HighlightingParameters.ts │ │ │ ├── Hightlightings.ts │ │ │ └── QueryHighlightings.ts │ │ ├── IFilterFactory.ts │ │ ├── IIndexQuery.ts │ │ ├── IndexQuery.ts │ │ ├── IndexQueryBase.ts │ │ ├── IndexQueryWithParameters.ts │ │ ├── MoreLikeThis │ │ │ ├── IMoreLikeThisBuilderBase.ts │ │ │ ├── IMoreLikeThisBuilderForDocumentQuery.ts │ │ │ ├── IMoreLikeThisOperations.ts │ │ │ ├── MoreLikeThisBase.ts │ │ │ ├── MoreLikeThisBuilder.ts │ │ │ ├── MoreLikeThisOptions.ts │ │ │ ├── MoreLikeThisScope.ts │ │ │ ├── MoreLikeThisStopWords.ts │ │ │ ├── MoreLikeThisUsingAnyDocument.ts │ │ │ ├── MoreLikeThisUsingDocument.ts │ │ │ └── MoreLikeThisUsingDocumentForDocumentQuery.ts │ │ ├── ProjectionBehavior.ts │ │ ├── QueryData.ts │ │ ├── QueryFieldUtil.ts │ │ ├── QueryOperationOptions.ts │ │ ├── QueryOperator.ts │ │ ├── QueryResult.ts │ │ ├── QueryResultBase.ts │ │ ├── SearchOperator.ts │ │ ├── Sorting │ │ │ └── SorterDefinition.ts │ │ ├── Spatial │ │ │ ├── CircleCriteria.ts │ │ │ ├── DynamicSpatialField.ts │ │ │ ├── PointField.ts │ │ │ ├── SpatialCriteria.ts │ │ │ ├── SpatialCriteriaFactory.ts │ │ │ ├── WktCriteria.ts │ │ │ └── WktField.ts │ │ ├── Suggestions │ │ │ ├── ISuggestionBuilder.ts │ │ │ ├── ISuggestionDocumentQuery.ts │ │ │ ├── ISuggestionOperations.ts │ │ │ ├── StringDistanceTypes.ts │ │ │ ├── SuggestionBase.ts │ │ │ ├── SuggestionBuilder.ts │ │ │ ├── SuggestionDocumentQuery.ts │ │ │ ├── SuggestionOptions.ts │ │ │ ├── SuggestionQueryBase.ts │ │ │ ├── SuggestionResult.ts │ │ │ ├── SuggestionSortMode.ts │ │ │ ├── SuggestionWithTerm.ts │ │ │ └── SuggestionWithTerms.ts │ │ ├── TimeSeries │ │ │ ├── ITimeSeriesQueryBuilder.ts │ │ │ ├── TimeSeriesAggregationResult.ts │ │ │ ├── TimeSeriesQueryBuilder.ts │ │ │ ├── TimeSeriesQueryResult.ts │ │ │ ├── TimeSeriesRangeAggregation.ts │ │ │ ├── TimeSeriesRawResult.ts │ │ │ ├── TypedTimeSeriesAggregationResult.ts │ │ │ ├── TypedTimeSeriesRangeAggregation.ts │ │ │ └── TypedTimeSeriesRawResult.ts │ │ └── Timings │ │ │ └── QueryTimings.ts │ ├── Replication │ │ ├── ExternalReplication.ts │ │ ├── ExternalReplicationBase.ts │ │ └── ReplicationNode.ts │ ├── Session │ │ ├── AbstractDocumentQuery.ts │ │ ├── AdvancedSessionExtensionBase.ts │ │ ├── ClusterTransactionOperations.ts │ │ ├── ClusterTransactionOperationsBase.ts │ │ ├── CmpXchg.ts │ │ ├── ConditionalLoadResult.ts │ │ ├── CounterInternalTypes.ts │ │ ├── DocumentInfo.ts │ │ ├── DocumentQuery.ts │ │ ├── DocumentQueryCustomization.ts │ │ ├── DocumentQueryHelper.ts │ │ ├── DocumentResultStream.ts │ │ ├── DocumentSession.ts │ │ ├── DocumentSessionAttachments.ts │ │ ├── DocumentSessionAttachmentsBase.ts │ │ ├── DocumentSessionRevisions.ts │ │ ├── DocumentSessionRevisionsBase.ts │ │ ├── DocumentsById.ts │ │ ├── DocumentsChanges.ts │ │ ├── EntityToJson.ts │ │ ├── ForceRevisionStrategy.ts │ │ ├── GroupByDocumentQuery.ts │ │ ├── GroupByField.ts │ │ ├── IAbstractDocumentQuery.ts │ │ ├── IAbstractDocumentQueryImpl.ts │ │ ├── IAdvancedSessionOperations.ts │ │ ├── IAttachmentsSessionOperations.ts │ │ ├── IAttachmentsSessionOperationsBase.ts │ │ ├── IClusterTransactionOperations.ts │ │ ├── IDocumentQuery.ts │ │ ├── IDocumentQueryBase.ts │ │ ├── IDocumentQueryBaseSingle.ts │ │ ├── IDocumentQueryBuilder.ts │ │ ├── IDocumentQueryCustomization.ts │ │ ├── IDocumentSession.ts │ │ ├── IEnumerableQuery.ts │ │ ├── IFilterDocumentQueryBase.ts │ │ ├── IGroupByDocumentQuery.ts │ │ ├── ILazyClusterTransactionOperations.ts │ │ ├── ILazyRevisionsOperations.ts │ │ ├── IMetadataDictionary.ts │ │ ├── IPagingDocumentQueryBase.ts │ │ ├── IQueryBase.ts │ │ ├── IRawDocumentQuery.ts │ │ ├── IRevisionsSessionOperations.ts │ │ ├── ISessionDocumentAppendTimeSeriesBase.ts │ │ ├── ISessionDocumentCounters.ts │ │ ├── ISessionDocumentDeleteTimeSeriesBase.ts │ │ ├── ISessionDocumentIncrementalTimeSeries.ts │ │ ├── ISessionDocumentRollupTypedAppendTimeSeriesBase.ts │ │ ├── ISessionDocumentRollupTypedTimeSeries.ts │ │ ├── ISessionDocumentTimeSeries.ts │ │ ├── ISessionDocumentTypedAppendTimeSeriesBase.ts │ │ ├── ISessionDocumentTypedIncrementalTimeSeries.ts │ │ ├── ISessionDocumentTypedTimeSeries.ts │ │ ├── InMemoryDocumentSessionOperations.ts │ │ ├── IncludesUtil.ts │ │ ├── JavaScriptArray.ts │ │ ├── JavaScriptMap.ts │ │ ├── Loaders │ │ │ ├── IAbstractTimeSeriesIncludeBuilder.ts │ │ │ ├── ICompareExchangeValueIncludeBuilder.ts │ │ │ ├── ICounterIncludeBuilder.ts │ │ │ ├── IDocumentIncludeBuilder.ts │ │ │ ├── IGenericIncludeBuilder.ts │ │ │ ├── IGenericRevisionIncludeBuilder.ts │ │ │ ├── IGenericTimeSeriesIncludeBuilder.ts │ │ │ ├── IIncludeBuilder.ts │ │ │ ├── ILazyLoaderWithInclude.ts │ │ │ ├── ILoaderWithInclude.ts │ │ │ ├── IQueryIncludeBuilder.ts │ │ │ ├── ISubscriptionIncludeBuilder.ts │ │ │ ├── ISubscriptionTimeSeriesIncludeBuilder.ts │ │ │ ├── ITimeSeriesIncludeBuilder.ts │ │ │ ├── IncludeBuilder.ts │ │ │ ├── IncludeBuilderBase.ts │ │ │ ├── LazyMultiLoaderWithInclude.ts │ │ │ ├── MultiLoaderWithInclude.ts │ │ │ ├── QueryIncludeBuilder.ts │ │ │ ├── SubscriptionIncludeBuilder.ts │ │ │ └── TimeSeriesIncludeBuilder.ts │ │ ├── MetadataObject.ts │ │ ├── MethodCall.ts │ │ ├── Operations │ │ │ ├── BatchCommandResult.ts │ │ │ ├── BatchOperation.ts │ │ │ ├── GetRevisionOperation.ts │ │ │ ├── GetRevisionsCountOperation.ts │ │ │ ├── Lazy │ │ │ │ ├── IEagerSessionOperations.ts │ │ │ │ ├── ILazyOperation.ts │ │ │ │ ├── ILazySessionOperations.ts │ │ │ │ ├── LazyAggregationQueryOperation.ts │ │ │ │ ├── LazyClusterTransactionOperations.ts │ │ │ │ ├── LazyConditionalLoadOperation.ts │ │ │ │ ├── LazyGetCompareExchangeValueOperation.ts │ │ │ │ ├── LazyGetCompareExchangeValuesOperation.ts │ │ │ │ ├── LazyLoadOperation.ts │ │ │ │ ├── LazyQueryOperation.ts │ │ │ │ ├── LazyRevisionOperation.ts │ │ │ │ ├── LazyRevisionOperations.ts │ │ │ │ ├── LazySessionOperations.ts │ │ │ │ ├── LazyStartsWithOperation.ts │ │ │ │ └── LazySuggestionQueryOperation.ts │ │ │ ├── LoadOperation.ts │ │ │ ├── LoadStartingWithOperation.ts │ │ │ ├── MultiGetOperation.ts │ │ │ ├── QueryOperation.ts │ │ │ └── StreamOperation.ts │ │ ├── OrderingType.ts │ │ ├── QueryEvents.ts │ │ ├── QueryOptions.ts │ │ ├── QueryStatistics.ts │ │ ├── Querying │ │ │ └── Sharding │ │ │ │ ├── IQueryShardedContextBuilder.ts │ │ │ │ └── QueryShardedContextBuilder.ts │ │ ├── RawDocumentQuery.ts │ │ ├── ResponseTimeInformation.ts │ │ ├── SessionCountersBase.ts │ │ ├── SessionDocumentCounters.ts │ │ ├── SessionDocumentRollupTypedTimeSeries.ts │ │ ├── SessionDocumentTimeSeries.ts │ │ ├── SessionDocumentTypedTimeSeries.ts │ │ ├── SessionEvents.ts │ │ ├── SessionOptions.ts │ │ ├── SessionTimeSeriesBase.ts │ │ ├── ShardedBatchBehavior.ts │ │ ├── StreamQueryStatistics.ts │ │ ├── TimeSeries │ │ │ ├── TimeSeriesEntry.ts │ │ │ ├── TimeSeriesValue.ts │ │ │ ├── TimeSeriesValuesHelper.ts │ │ │ ├── TypedTimeSeriesEntry.ts │ │ │ └── TypedTimeSeriesRollupEntry.ts │ │ ├── Tokens │ │ │ ├── CloseSubclauseToken.ts │ │ │ ├── CompareExchangeValueIncludesToken.ts │ │ │ ├── CounterIncludesToken.ts │ │ │ ├── DeclareToken.ts │ │ │ ├── DistinctToken.ts │ │ │ ├── ExplanationToken.ts │ │ │ ├── FacetToken.ts │ │ │ ├── FieldsToFetchToken.ts │ │ │ ├── FromToken.ts │ │ │ ├── GroupByCountToken.ts │ │ │ ├── GroupByKeyToken.ts │ │ │ ├── GroupBySumToken.ts │ │ │ ├── GroupByToken.ts │ │ │ ├── HighlightingToken.ts │ │ │ ├── IntersectMarkerToken.ts │ │ │ ├── LoadToken.ts │ │ │ ├── MoreLikeThisToken.ts │ │ │ ├── NegateToken.ts │ │ │ ├── OpenSubclauseToken.ts │ │ │ ├── OrderByToken.ts │ │ │ ├── QueryOperatorToken.ts │ │ │ ├── QueryToken.ts │ │ │ ├── RevisionIncludesToken.ts │ │ │ ├── ShapeToken.ts │ │ │ ├── SuggestToken.ts │ │ │ ├── TimeSeriesIncludesToken.ts │ │ │ ├── TimingsToken.ts │ │ │ ├── TrueToken.ts │ │ │ ├── WhereOperator.ts │ │ │ └── WhereToken.ts │ │ ├── TransactionMode.ts │ │ └── WhereParams.ts │ ├── SetupDocumentBase.ts │ ├── Smuggler │ │ ├── BackupUtils.ts │ │ ├── DatabaseItemType.ts │ │ ├── DatabaseRecordItemType.ts │ │ ├── DatabaseSmuggler.ts │ │ ├── DatabaseSmugglerExportOptions.ts │ │ ├── DatabaseSmugglerImportOptions.ts │ │ ├── DatabaseSmugglerOptions.ts │ │ ├── ExportCompressionAlgorithm.ts │ │ ├── IDatabaseSmugglerExportOptions.ts │ │ ├── IDatabaseSmugglerImportOptions.ts │ │ └── IDatabaseSmugglerOptions.ts │ ├── Subscriptions │ │ ├── AbstractSubscriptionWorker.ts │ │ ├── BatchFromServer.ts │ │ ├── CreateSubscriptionResult.ts │ │ ├── DocumentSubscriptions.ts │ │ ├── GetSubscriptionsResult.ts │ │ ├── NodeId.ts │ │ ├── Revision.ts │ │ ├── SubscriptionBatch.ts │ │ ├── SubscriptionBatchBase.ts │ │ ├── SubscriptionConnectionClientMessage.ts │ │ ├── SubscriptionConnectionServerMessage.ts │ │ ├── SubscriptionCreationOptions.ts │ │ ├── SubscriptionMode.ts │ │ ├── SubscriptionOpeningStrategy.ts │ │ ├── SubscriptionShardingState.ts │ │ ├── SubscriptionState.ts │ │ ├── SubscriptionStateWithNodeDetails.ts │ │ ├── SubscriptionTryout.ts │ │ ├── SubscriptionUpdateOptions.ts │ │ ├── SubscriptionWorker.ts │ │ ├── SubscriptionWorkerOptions.ts │ │ └── UpdateSubscriptionResult.ts │ └── TimeSeries │ │ └── TimeSeriesOperations.ts ├── Exceptions │ └── index.ts ├── Http │ ├── AggressiveCacheOptions.ts │ ├── Behaviors │ │ ├── AbstractCommandResponseBehavior.ts │ │ └── DefaultCommandResponseBehavior.ts │ ├── ClusterRequestExecutor.ts │ ├── ClusterTopology.ts │ ├── CurrentIndexAndNode.ts │ ├── CurrentIndexAndNodeAndEtag.ts │ ├── HttpCache.ts │ ├── HttpCompressionAlgorithm.ts │ ├── IBroadcast.ts │ ├── IRaftCommand.ts │ ├── LoadBalanceBehavior.ts │ ├── NodeSelector.ts │ ├── RavenCommand.ts │ ├── RavenCommandResponsePipeline.ts │ ├── ReadBalanceBehavior.ts │ ├── RequestExecutor.ts │ ├── ServerNode.ts │ ├── StatusCode.ts │ ├── Topology.ts │ ├── UpdateTopologyParameters.ts │ └── UriUtility.ts ├── Mapping │ ├── Json │ │ ├── Replacers.ts │ │ ├── Revivers.ts │ │ ├── Serializer.ts │ │ ├── Streams │ │ │ ├── CollectResultStream.ts │ │ │ ├── ObjectKeyCaseTransformStream.ts │ │ │ └── Pipelines.ts │ │ └── index.ts │ ├── JsonOperation.ts │ ├── MetadataAsDictionary.ts │ └── ObjectMapper.ts ├── Primitives │ ├── CaseInsensitiveKeysMap.ts │ ├── CaseInsensitiveKeysStore.ts │ ├── CaseInsensitiveStringSet.ts │ ├── DatesComparator.ts │ ├── Events.ts │ ├── Http.ts │ ├── TimeValue.ts │ ├── TimeValueUnit.ts │ └── Timer.ts ├── ServerWide │ ├── Commands │ │ ├── Cluster │ │ │ └── AddClusterNodeCommand.ts │ │ ├── GetClusterTopologyCommand.ts │ │ ├── GetDatabaseTopologyCommand.ts │ │ ├── GetNodeInfoCommand.ts │ │ ├── GetTcpInfoCommand.ts │ │ └── NodeInfo.ts │ ├── CompactSettings.ts │ ├── DeletionInProgressStatus.ts │ ├── DocumentsCompressionConfiguration.ts │ ├── IDatabaseTaskStatus.ts │ ├── ModifyOnGoingTaskResult.ts │ ├── Operations │ │ ├── AddDatabaseNodeOperation.ts │ │ ├── Analyzers │ │ │ ├── DeleteServerWideAnalyzerOperation.ts │ │ │ └── PutServerWideAnalyzersOperation.ts │ │ ├── BuildNumber.ts │ │ ├── Builder │ │ │ ├── IBackupConfigurationBuilder.ts │ │ │ ├── IConnectionStringConfigurationBuilder.ts │ │ │ ├── IDatabaseRecordBuilder.ts │ │ │ ├── IDatabaseRecordBuilderBase.ts │ │ │ ├── IDatabaseRecordBuilderInitializer.ts │ │ │ ├── IEtlConfigurationBuilder.ts │ │ │ ├── IIntegrationConfigurationBuilder.ts │ │ │ ├── IOrchestratorTopologyConfigurationBuilder.ts │ │ │ ├── IReplicationConfigurationBuilder.ts │ │ │ ├── IShardTopologyConfigurationBuilder.ts │ │ │ ├── IShardedDatabaseRecordBuilder.ts │ │ │ ├── IShardedTopologyConfigurationBuilder.ts │ │ │ ├── ITopologyConfigurationBuilder.ts │ │ │ └── ITopologyConfigurationBuilderBase.ts │ │ ├── Certificates │ │ │ ├── CertificateDefinition.ts │ │ │ ├── CertificateMetadata.ts │ │ │ ├── CertificateRawData.ts │ │ │ ├── CreateClientCertificateOperation.ts │ │ │ ├── DatabaseAccess.ts │ │ │ ├── DeleteCertificateOperation.ts │ │ │ ├── EditClientCertificateOperation.ts │ │ │ ├── GetCertificateMetadataOperation.ts │ │ │ ├── GetCertificateOperation.ts │ │ │ ├── GetCertificatesMetadataOperation.ts │ │ │ ├── GetCertificatesOperation.ts │ │ │ ├── GetCertificatesResponse.ts │ │ │ ├── PutClientCertificateOperation.ts │ │ │ ├── ReplaceClusterCertificateOperation.ts │ │ │ └── SecurityClearance.ts │ │ ├── Configuration │ │ │ ├── DatabaseSettings.ts │ │ │ ├── GetDatabaseSettingsOperation.ts │ │ │ ├── GetServerWideBackupConfigurationOperation.ts │ │ │ ├── GetServerWideBackupConfigurationsOperation.ts │ │ │ ├── GetServerWideClientConfigurationOperation.ts │ │ │ ├── PutDatabaseSettingsOperation.ts │ │ │ ├── PutServerWideBackupConfigurationOperation.ts │ │ │ ├── PutServerWideClientConfigurationOperation.ts │ │ │ └── ServerWideBackupConfiguration.ts │ │ ├── ConfigureRevisionsForConflictsOperation.ts │ │ ├── CreateDatabaseOperation.ts │ │ ├── DatabaseRecordBuilder.ts │ │ ├── DeleteDatabasesOperation.ts │ │ ├── DocumentsCompression │ │ │ ├── DocumentCompressionConfigurationResult.ts │ │ │ └── UpdateDocumentsCompressionConfigurationOperation.ts │ │ ├── GetBuildNumberOperation.ts │ │ ├── GetDatabaseNamesOperation.ts │ │ ├── GetDatabaseRecordOperation.ts │ │ ├── GetServerWideOperationStateOperation.ts │ │ ├── Integrations │ │ │ └── PostgreSql │ │ │ │ ├── IntegrationConfigurations.ts │ │ │ │ ├── PostgreSqlAuthenticationConfiguration.ts │ │ │ │ ├── PostgreSqlConfiguration.ts │ │ │ │ └── PostgreSqlUser.ts │ │ ├── Logs │ │ │ ├── GetLogsConfigurationOperation.ts │ │ │ ├── GetLogsConfigurationResult.ts │ │ │ ├── LogMode.ts │ │ │ └── SetLogsConfigurationOperation.ts │ │ ├── ModifyConflictSolverOperation.ts │ │ ├── ModifyDatabaseTopologyOperation.ts │ │ ├── ModifyDatabaseTopologyResult.ts │ │ ├── OngoingTasks │ │ │ ├── DeleteServerWideTaskOperation.ts │ │ │ ├── GetServerWideExternalReplicationOperation.ts │ │ │ ├── IServerWideTask.ts │ │ │ ├── PutServerWideExternalReplicationOperation.ts │ │ │ ├── ServerWideExternalReplication.ts │ │ │ ├── ServerWideTaskResponse.ts │ │ │ ├── SetDatabasesLockOperation.ts │ │ │ └── ToggleServerWideTaskStateOperation.ts │ │ ├── PromoteDatabaseNodeOperation.ts │ │ ├── ReorderDatabaseMembersOperation.ts │ │ ├── ServerWideOperationCompletionAwaiter.ts │ │ ├── SetDatabaseDynamicDistributionOperation.ts │ │ ├── Sorters │ │ │ ├── DeleteServerWideSorterOperation.ts │ │ │ └── PutServerWideSortersOperation.ts │ │ ├── UpdateDatabaseOperation.ts │ │ ├── UpdateUnusedDatabasesOperation.ts │ │ └── index.ts │ ├── OrchestratorTopology.ts │ ├── Sharding │ │ ├── AddDatabaseShardOperation.ts │ │ ├── AddNodeToOrchestratorTopologyOperation.ts │ │ ├── MigrationStatus.ts │ │ ├── OrchestratorConfiguration.ts │ │ ├── PrefixedShardingSetting.ts │ │ ├── RemoveNodeFromOrchestratorTopologyOperation.ts │ │ ├── ShardBucketMigration.ts │ │ ├── ShardBucketRange.ts │ │ └── ShardingConfiguration.ts │ ├── Tcp │ │ ├── LicensedFeatures.ts │ │ ├── TcpConnectionHeaderMessage.ts │ │ ├── TcpConnectionHeaderResponse.ts │ │ ├── TcpConnectionStatus.ts │ │ ├── TcpNegotiateParameters.ts │ │ ├── TcpNegotiation.ts │ │ └── TcpNegotiationResponse.ts │ └── index.ts ├── Types │ ├── Callbacks.ts │ ├── Contracts.ts │ ├── IRavenObject.ts │ └── index.ts ├── Utility │ ├── ArrayUtil.ts │ ├── ClientShardHelper.ts │ ├── DateUtil.ts │ ├── HttpUtil.ts │ ├── ImportUtil.ts │ ├── LogUtil.ts │ ├── ObjectUtil.ts │ ├── OsUtil.ts │ ├── PromiseUtil.ts │ ├── RaftIdGenerator.ts │ ├── Reference.ts │ ├── Semaphore.ts │ ├── SemaphoreUtil.ts │ ├── SizeUtil.ts │ ├── Stopwatch.ts │ ├── StreamUtil.ts │ ├── StringBuilder.ts │ ├── StringUtil.ts │ ├── TcpUtils.ts │ ├── TimeUtil.ts │ ├── TypeUtil.ts │ └── UriUtil.ts ├── ext │ ├── pluralize │ │ └── pluralize.ts │ └── stream-json │ │ ├── Assembler.ts │ │ ├── Parser.ts │ │ ├── Stringer.ts │ │ ├── jsonl │ │ ├── Parser.ts │ │ └── Stringer.ts │ │ ├── streamers │ │ ├── StreamBase.ts │ │ └── StreamValues.ts │ │ └── utils │ │ └── Utf8Stream.ts └── index.ts ├── test ├── Assets │ ├── Entities.ts │ ├── Faceted.ts │ ├── Indexes.ts │ ├── Orders.ts │ ├── Samples.ts │ ├── loadResult.json │ ├── queryResult.json │ ├── test_cert.conf │ └── tubes.png ├── Documents │ ├── Commands │ │ ├── DatabaseCommands.ts │ │ ├── DeleteDocumentCommandTest.ts │ │ ├── GetDocumentCommandTests.ts │ │ ├── GetNextOperationIdCommandTests.ts │ │ ├── GetStatisticsCommandTests.ts │ │ └── PutDocumentCommandTests.ts │ ├── CustomKeyCaseConventionsTests.ts │ ├── DisableTrackingTests.ts │ ├── IdGeneration.ts │ ├── MetadataAsDictTests.ts │ ├── Operations │ │ ├── ClientConfigurationTest.ts │ │ ├── DeleteByQueryTest.ts │ │ └── IndexesOperationsTests.ts │ ├── PeriodicBackup │ │ └── ServerWideBackup.ts │ ├── Queries │ │ ├── HashCalculatorTest.ts │ │ └── IDocumentQueryCustomizationMethodsTest.ts │ └── SessionApiTests.ts ├── ExceptionTest.ts ├── Executor │ ├── CompressionTests.ts │ └── RequestExecutorTests.ts ├── Infrastructure │ └── GenerateCertificateOperation.ts ├── Issues │ ├── Github_204.ts │ ├── Github_315.ts │ ├── Github_67.ts │ ├── RDBC-244.ts │ ├── RDBC-728.ts │ ├── RDBC_202.ts │ ├── RDBC_203.ts │ ├── RDBC_213.ts │ ├── RDBC_230.ts │ ├── RDBC_233.ts │ ├── RDBC_236.ts │ ├── RDBC_247.ts │ ├── RDBC_259.ts │ ├── RDBC_265.ts │ ├── RDBC_404.ts │ ├── RDBC_501.ts │ ├── RDBC_543.ts │ ├── RDBC_594.ts │ ├── RDBC_615.ts │ ├── RDBC_646.ts │ ├── RDBC_649.ts │ ├── RDBC_653.ts │ ├── RDBC_658.ts │ ├── RDBC_681.ts │ ├── RDBC_714.ts │ ├── RDBC_825.ts │ ├── RavenDB_10566.ts │ ├── RavenDB_10638.ts │ ├── RavenDB_10641.ts │ ├── RavenDB_11649.ts │ ├── RavenDB_11703.ts │ ├── RavenDB_11770.ts │ ├── RavenDB_12932.ts │ ├── RavenDB_14084.ts │ └── RavenDB_9584.ts ├── Mapping │ ├── JsonTests.ts │ ├── ObjectMapperTests.ts │ ├── ObjectUtilTests.ts │ └── StreamJsonTests.ts ├── Ported │ ├── Attachments │ │ ├── AttachmentsRevisionsTest.ts │ │ ├── AttachmentsSessionTest.ts │ │ └── BulkInsertAttachmentsTest.ts │ ├── BackupsTest.ts │ ├── Bugs │ │ ├── Caching │ │ │ └── CachingOfDocumentInclude.ts │ │ ├── MultiMapWithCustomPropertiesTest.ts │ │ └── SimpleMultiMapTest.ts │ ├── BulkInsert │ │ └── BulkInsertsTest.ts │ ├── Cluster │ │ ├── ClusterModesForRequestExecutorTest.ts │ │ ├── ClusterOperationTest.ts │ │ └── ClusterTransactionTest.ts │ ├── CompactTest.ts │ ├── ConditionalLoadTest.ts │ ├── ContainsTest.ts │ ├── Core │ │ ├── Commands │ │ │ └── Other.ts │ │ └── Streaming │ │ │ ├── DocumentStreaming.ts │ │ │ └── QueryStreaming.ts │ ├── Counters │ │ ├── BulkInsertCountersTest.ts │ │ ├── CountersSingleNodeTest.ts │ │ ├── PatchOnCountersTest.ts │ │ ├── QueryOnCountersTest.ts │ │ └── SessionCountersTest.ts │ ├── CrudTest.ts │ ├── CustomEntityName.ts │ ├── CustomSerializationTest.ts │ ├── DatabaseSettingsOperationTest.ts │ ├── DeleteTest.ts │ ├── Documents │ │ ├── BasicDocumentsTest.ts │ │ ├── CanQueryAndIncludeRevisions.ts │ │ ├── Commands │ │ │ ├── CanGetBuildNumberTest.ts │ │ │ └── ReorderDatabaseMembersTest.ts │ │ ├── DataArchival │ │ │ └── DataArchival.ts │ │ ├── LoadTest.ts │ │ └── Operations │ │ │ └── ConnectionStringsTest.ts │ ├── ExistsTest.ts │ ├── Faceted │ │ ├── AggregationTest.ts │ │ └── FacetPagingTest.ts │ ├── FilteredReplicationTest.ts │ ├── FirstClassPatchTest.ts │ ├── ForceRevisionCreation.ts │ ├── HiLoTest.ts │ ├── HttpsTest.ts │ ├── Indexing │ │ ├── Counters │ │ │ ├── BasicCountersIndexes_JavaScriptTest.ts │ │ │ └── BasicCountersIndexes_StrongSyntaxTest.ts │ │ ├── DetectIndexTypeTest.ts │ │ ├── IndexesFromClientTest.ts │ │ ├── JavaScriptIndexTest.ts │ │ ├── StronglyTypedJavaScriptIndexTest.ts │ │ ├── TimeSeries │ │ │ ├── BasicTimeSeriesIndexes_JavaScriptTest.ts │ │ │ ├── BasicTimeSeriesIndexes_MixedSyntaxTest.ts │ │ │ └── BasicTimeSeriesIndexes_StrongSyntaxTest.ts │ │ └── TimeSeriesIndexStreamTest.ts │ ├── Issues │ │ ├── RDBC_316.ts │ │ ├── RDBC_339.ts │ │ ├── RDBC_387.ts │ │ ├── RDBC_435.ts │ │ ├── RDBC_440.ts │ │ ├── RDBC_501.ts │ │ ├── RDBC_538.ts │ │ ├── RDBC_693.ts │ │ ├── RDBC_751.ts │ │ ├── RavenDB_10038.ts │ │ ├── RavenDB_10929.ts │ │ ├── RavenDB_11058.ts │ │ ├── RavenDB_11166.ts │ │ ├── RavenDB_11217.ts │ │ ├── RavenDB_11440.ts │ │ ├── RavenDB_11552.ts │ │ ├── RavenDB_12030.ts │ │ ├── RavenDB_12132.ts │ │ ├── RavenDB_12169.ts │ │ ├── RavenDB_12257.ts │ │ ├── RavenDB_12748.ts │ │ ├── RavenDB_12790.ts │ │ ├── RavenDB_12816.ts │ │ ├── RavenDB_12902.ts │ │ ├── RavenDB_13034.ts │ │ ├── RavenDB_13100.ts │ │ ├── RavenDB_13452.ts │ │ ├── RavenDB_13456.ts │ │ ├── RavenDB_13478.ts │ │ ├── RavenDB_13682.ts │ │ ├── RavenDB_13735.ts │ │ ├── RavenDB_13762.ts │ │ ├── RavenDB_14005.ts │ │ ├── RavenDB_14006.ts │ │ ├── RavenDB_14109.ts │ │ ├── RavenDB_14164.ts │ │ ├── RavenDB_14230.ts │ │ ├── RavenDB_14272.ts │ │ ├── RavenDB_14276.ts │ │ ├── RavenDB_14600.ts │ │ ├── RavenDB_14724.ts │ │ ├── RavenDB_14811.ts │ │ ├── RavenDB_14881.ts │ │ ├── RavenDB_14919.ts │ │ ├── RavenDB_14939.ts │ │ ├── RavenDB_14978.ts │ │ ├── RavenDB_14989.ts │ │ ├── RavenDB_14994.ts │ │ ├── RavenDB_15000.ts │ │ ├── RavenDB_15029.ts │ │ ├── RavenDB_15076.ts │ │ ├── RavenDB_15080.ts │ │ ├── RavenDB_15109.ts │ │ ├── RavenDB_15134.ts │ │ ├── RavenDB_15143.ts │ │ ├── RavenDB_15246.ts │ │ ├── RavenDB_15282.ts │ │ ├── RavenDB_15313.ts │ │ ├── RavenDB_15402.ts │ │ ├── RavenDB_15492.ts │ │ ├── RavenDB_15497.ts │ │ ├── RavenDB_15521.ts │ │ ├── RavenDB_15531.ts │ │ ├── RavenDB_15539.ts │ │ ├── RavenDB_15690.ts │ │ ├── RavenDB_15693.ts │ │ ├── RavenDB_15706.ts │ │ ├── RavenDB_15753.ts │ │ ├── RavenDB_15792.ts │ │ ├── RavenDB_15825.ts │ │ ├── RavenDB_15826.ts │ │ ├── RavenDB_16035.ts │ │ ├── RavenDB_16060.ts │ │ ├── RavenDB_16262.ts │ │ ├── RavenDB_16301.ts │ │ ├── RavenDB_16321.ts │ │ ├── RavenDB_16328.ts │ │ ├── RavenDB_16328_Analyzers.ts │ │ ├── RavenDB_16334.ts │ │ ├── RavenDB_16367.ts │ │ ├── RavenDB_16537.ts │ │ ├── RavenDB_16614.ts │ │ ├── RavenDB_16906.ts │ │ ├── RavenDB_16929.ts │ │ ├── RavenDB_16975.ts │ │ ├── RavenDB_16985.ts │ │ ├── RavenDB_17012.ts │ │ ├── RavenDB_17041.ts │ │ ├── RavenDB_17154.ts │ │ ├── RavenDB_17420.ts │ │ ├── RavenDB_17551.ts │ │ ├── RavenDB_17624.ts │ │ ├── RavenDB_17636.ts │ │ ├── RavenDB_17699.ts │ │ ├── RavenDB_18364.ts │ │ ├── RavenDB_18427.ts │ │ ├── RavenDB_18545.ts │ │ ├── RavenDB_18643.ts │ │ ├── RavenDB_18648.ts │ │ ├── RavenDB_18664.ts │ │ ├── RavenDB_18936.ts │ │ ├── RavenDB_19538.ts │ │ ├── RavenDB_19545.ts │ │ ├── RavenDB_19559.ts │ │ ├── RavenDB_19598.ts │ │ ├── RavenDB_19938.ts │ │ ├── RavenDB_21264.ts │ │ ├── RavenDB_21339.ts │ │ ├── RavenDB_21574.ts │ │ ├── RavenDB_5669.ts │ │ ├── RavenDB_6292.ts │ │ ├── RavenDB_6558.ts │ │ ├── RavenDB_6667.ts │ │ ├── RavenDB_6967.ts │ │ ├── RavenDB_7162.ts │ │ ├── RavenDB_8328Test.ts │ │ ├── RavenDB_8355.ts │ │ ├── RavenDB_903.ts │ │ ├── RavenDB_9587.ts │ │ ├── RavenDB_9745.ts │ │ └── RavenDB_9889.ts │ ├── Lazy │ │ └── LazyTest.ts │ ├── LoadIntoStreamTest.ts │ ├── LoadTest.ts │ ├── MailingList │ │ ├── LazyAggregationEmbedded.ts │ │ ├── LoadAllStartingWith.ts │ │ ├── NoTrackingTest.ts │ │ └── SpuriousSaveChanges.ts │ ├── MoreLikeThis │ │ └── MoreLikeThisTest.ts │ ├── NextAndSeedIdentitiesTest.ts │ ├── PatchTest.ts │ ├── Queries │ │ ├── HighlightsTest.ts │ │ ├── QueriesWithCustomFunctionsTests.ts │ │ ├── QueriesWithIncludesTests.ts │ │ └── RegexQueryTest.ts │ ├── QueryTest.ts │ ├── RachisTests │ │ └── DatabaseCluster │ │ │ └── AtomicClusterReadWriteTest.ts │ ├── RequestExecutor.ts │ ├── RevisionsTest.ts │ ├── Server │ │ ├── DatabasesTest.ts │ │ ├── Documents │ │ │ ├── CompressAllCollectionsTest.ts │ │ │ ├── Indexing │ │ │ │ └── RavenDB_8761.ts │ │ │ ├── Notifications │ │ │ │ ├── ChangesTest.ts │ │ │ │ └── SecuredChangesTest.ts │ │ │ └── Replication │ │ │ │ └── ServerWideReplicationTest.ts │ │ ├── Etl │ │ │ ├── ElasticSearch │ │ │ │ └── ElasticSearchTest.ts │ │ │ ├── Olap │ │ │ │ └── OlapTest.ts │ │ │ ├── Queue │ │ │ │ ├── KafkaTest.ts │ │ │ │ └── RabbitMqTest.ts │ │ │ ├── Raven │ │ │ │ └── EtlTest.ts │ │ │ ├── Sink │ │ │ │ └── QueueSink.ts │ │ │ └── Sql │ │ │ │ └── SqlTest.ts │ │ ├── ExpirationConfigurationTest.ts │ │ ├── LogsConfigurationTest.ts │ │ ├── Patching │ │ │ └── AdvancedPatchingTest.ts │ │ ├── PromoteDatabaseTest.ts │ │ ├── RecordingTransactionOperationsMergerTest.ts │ │ └── Replication │ │ │ ├── ConflictSolverTest.ts │ │ │ ├── DocumentReplicationTest.ts │ │ │ ├── PullReplicationPreventDeletionsTest.ts │ │ │ ├── PullReplicationTest.ts │ │ │ ├── ReplicationWithRevisions.ts │ │ │ └── ReplicationWriteAssuranceTest.ts │ ├── Session │ │ └── AddOrPatchTest.ts │ ├── SmugglerTest.ts │ ├── Spatial │ │ ├── BoundingBoxIndexTest.ts │ │ ├── RavenDB_9676.ts │ │ ├── SimonBartlettTest.ts │ │ ├── SpatialQueriesTest.ts │ │ ├── SpatialSearchTest.ts │ │ ├── SpatialSortingTest.ts │ │ └── SpatialTest.ts │ ├── StoreTest.ts │ ├── Subscriptions │ │ ├── RevisionsSubscriptionsTest.ts │ │ ├── SecuredSubscriptionsBasicTest.ts │ │ └── SubscriptionsBasicTest.ts │ ├── Suggestions │ │ ├── SuggestionsLazyTest.ts │ │ └── SuggestionsTest.ts │ ├── TimeSeries │ │ ├── IncrementalTimeSeriesTest.ts │ │ ├── TimeSeriesBulkInsertTest.ts │ │ ├── TimeSeriesConfiguration.ts │ │ ├── TimeSeriesDocumentQuery.ts │ │ ├── TimeSeriesIncludes.ts │ │ ├── TimeSeriesOperations.ts │ │ ├── TimeSeriesRangesCache.ts │ │ ├── TimeSeriesRawQuery.ts │ │ ├── TimeSeriesSessionTest.ts │ │ ├── TimeSeriesTypedSession.ts │ │ └── TypedBulkInsert.ts │ ├── TrackEntityTest.ts │ ├── UniqueValuesTest.ts │ └── WhatChangedTest.ts ├── Primitives │ ├── CaseInsensitivePrimitivesTests.ts │ ├── DatesComparatorTest.ts │ ├── TimeUtilTest.ts │ └── TypeUtilTests.ts ├── ServerWide │ ├── Commands │ │ └── ShardedDatabasesTest.ts │ ├── GetClusterTopologyCommandTests.ts │ ├── GetDatabaseRecordTest.ts │ ├── GetTcpInfoCommandTests.ts │ ├── GetTopologyCommandTests.ts │ └── RollingIndexingTest.ts ├── TestDriver │ ├── RavenServerLocator.ts │ ├── RavenServerRunner.ts │ └── index.ts ├── Utilities │ └── SemaphoreUtilTests.ts └── Utils │ ├── AdminJsConsoleOperation.ts │ ├── AssertExtensions.ts │ ├── AsyncQueue.ts │ ├── CreateSampleDataOperation.ts │ ├── FacetTestContext.ts │ ├── Json.ts │ ├── PromiseUtil.spec.ts │ ├── RavenTestHelper.ts │ ├── ReplicationTestContext.ts │ ├── Streams.ts │ └── TestUtil.ts ├── tsconfig.imports-check.json └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [src/**.ts] 4 | indent_style = space 5 | indent_size = 4 6 | ij_typescript_spaces_within_imports = true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | .idea/ 3 | node_modules/ 4 | dist/**/* 5 | lib/**/* 6 | dist/ 7 | *.map 8 | src/**/*.js 9 | !src/ext/**/*.js 10 | src/**/*.js.map 11 | test/**/*.js 12 | test/**/*.d.ts 13 | .build/ 14 | .tshy-build/ 15 | test/certs 16 | tryouts/ 17 | .DS_Store 18 | .tscache 19 | .settings 20 | npm-debug.log 21 | old 22 | .test 23 | !test/test.d.ts 24 | test_server_settings.json 25 | .nyc_output 26 | coverage 27 | -------------------------------------------------------------------------------- /.mocharc.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "slow": 1000, 3 | "timeout": 40000, 4 | 5 | "node-option": [ 6 | "import=./register.js" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.tshy/build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "../src", 5 | "module": "nodenext", 6 | "moduleResolution": "nodenext" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.tshy/commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./build.json", 3 | "include": [ 4 | "../src/**/*.ts", 5 | "../src/**/*.cts", 6 | "../src/**/*.tsx", 7 | "../src/**/*.json" 8 | ], 9 | "exclude": [ 10 | "../src/**/*.mts", 11 | "../src/package.json" 12 | ], 13 | "compilerOptions": { 14 | "outDir": "../.tshy-build/commonjs" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.tshy/esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./build.json", 3 | "include": [ 4 | "../src/**/*.ts", 5 | "../src/**/*.mts", 6 | "../src/**/*.tsx", 7 | "../src/**/*.json" 8 | ], 9 | "exclude": [ 10 | "../src/package.json" 11 | ], 12 | "compilerOptions": { 13 | "outDir": "../.tshy-build/esm" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /register.js: -------------------------------------------------------------------------------- 1 | import { register } from 'node:module'; 2 | import { pathToFileURL } from 'node:url'; 3 | 4 | register('ts-node/esm', pathToFileURL('./')); -------------------------------------------------------------------------------- /scripts/checkImports.cjs: -------------------------------------------------------------------------------- 1 | const RavenDB = require("../dist/commonjs/index.js"); 2 | const assert = require("node:assert"); 3 | 4 | const { DocumentStore, DateUtil } = RavenDB; 5 | assert.ok(DocumentStore); 6 | 7 | assert.ok(DateUtil.default.stringify(new Date())); 8 | assert.ok(DateUtil.default.parse("2024-05-05T00:00:00.000Z")); 9 | -------------------------------------------------------------------------------- /scripts/checkImports.mjs: -------------------------------------------------------------------------------- 1 | import { DocumentStore, DateUtil } from "../dist/esm/index.js"; 2 | import assert from "node:assert"; 3 | 4 | assert.ok(DocumentStore); 5 | 6 | assert.ok(DateUtil.default.stringify(new Date())); 7 | assert.ok(DateUtil.default.parse("2024-05-05T00:00:00.000Z")); -------------------------------------------------------------------------------- /scripts/clearGlobalExports.js: -------------------------------------------------------------------------------- 1 | import { unlinkSync, closeSync, openSync } from "node:fs"; 2 | // regexp to check: from "(../)*\.\." 3 | 4 | unlinkSync("./src/index.ts"); 5 | closeSync(openSync("./src/index.ts", 'w')); 6 | 7 | -------------------------------------------------------------------------------- /src/Auth/AuthOptions.ts: -------------------------------------------------------------------------------- 1 | import { CertificateType } from "./Certificate.js"; 2 | 3 | export interface IAuthOptions { 4 | type?: CertificateType; 5 | certificate?: string | Buffer; 6 | password?: string; 7 | ca?: string | Buffer; 8 | } 9 | 10 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 11 | export interface IStoreAuthOptions extends IAuthOptions { 12 | 13 | } 14 | 15 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 16 | export interface IRequestAuthOptions extends IAuthOptions { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/Documents/BulkInsert/BulkInsertOptions.ts: -------------------------------------------------------------------------------- 1 | export interface BulkInsertOptions { 2 | useCompression?: boolean; 3 | skipOverwriteIfUnchanged?: boolean; 4 | } -------------------------------------------------------------------------------- /src/Documents/BulkInsert/BulkInsertWriter.ts: -------------------------------------------------------------------------------- 1 | import { BulkInsertStream, BulkInsertWriterBase } from "./BulkInsertWriterBase.js"; 2 | import { Buffer } from "node:buffer"; 3 | import { throwError } from "../../Exceptions/index.js"; 4 | 5 | export class BulkInsertWriter extends BulkInsertWriterBase { 6 | public constructor() { 7 | super(); 8 | } 9 | 10 | protected onCurrentWriteStreamSet(currentWriteStream: BulkInsertStream) { 11 | // empty 12 | } 13 | 14 | // no need for flushIfNeeded -> it uses parent version 15 | 16 | public write(value: string | Buffer) { 17 | this._currentWriter.push(value); 18 | } 19 | 20 | private static throwUnexpectedWriteStream() { 21 | throwError("InvalidOperationException", "We got stream for which we don't have the stream writer defined"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Documents/Changes/AggressiveCacheChange.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseChange } from "./DatabaseChange.js"; 2 | import { DocumentChange } from "./DocumentChange.js"; 3 | import { IndexChange } from "./IndexChange.js"; 4 | 5 | export class AggressiveCacheChange implements DatabaseChange { 6 | public static readonly INSTANCE = new AggressiveCacheChange(); 7 | 8 | public static shouldUpdateAggressiveCache(change: DocumentChange | IndexChange): boolean { 9 | return change.type === "Put" || change.type === "Delete" || change.type === "BatchCompleted" || change.type === "IndexRemoved"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Changes/ChangesSupportedFeatures.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface ChangesSupportedFeatures { 4 | aggressiveCachingChange: boolean; 5 | topologyChange: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Changes/CounterChange.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseChange } from "./DatabaseChange.js"; 2 | 3 | export type CounterChangeTypes = "None" | "Put" | "Delete" | "Increment"; 4 | 5 | export interface CounterChange extends DatabaseChange { 6 | name: string; 7 | value: number; 8 | documentId: string; 9 | collectionName: string; 10 | changeVector: string; 11 | type: CounterChangeTypes; 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Changes/DatabaseChange.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 2 | export interface DatabaseChange { 3 | } 4 | -------------------------------------------------------------------------------- /src/Documents/Changes/DatabaseChangesOptions.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface DatabaseChangesOptions { 3 | databaseName: string; 4 | nodeTag: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Changes/DocumentChange.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseChange } from "./DatabaseChange.js"; 2 | 3 | export interface DocumentChange extends DatabaseChange { 4 | type: DocumentChangeTypes; 5 | id: string; 6 | collectionName: string; 7 | changeVector: string; 8 | } 9 | 10 | export type DocumentChangeTypes = 11 | "None" 12 | | "Put" 13 | | "Delete" 14 | | "Conflict" 15 | | "Common"; 16 | -------------------------------------------------------------------------------- /src/Documents/Changes/IChangesConnectionState.ts: -------------------------------------------------------------------------------- 1 | import { IDisposable } from "../../Types/Contracts.js"; 2 | 3 | export interface IChangesConnectionState extends IDisposable { 4 | inc(): void; 5 | 6 | dec(): void; 7 | 8 | error(e: Error): void; 9 | 10 | ensureSubscribedNow(): Promise; 11 | 12 | addOnChangeNotification(type: ChangesType, handler: (value: T) => void); 13 | 14 | removeOnChangeNotification(type: ChangesType, handler: (value: T) => void); 15 | 16 | addOnError(handler: (value: Error) => void); 17 | 18 | removeOnError(handler: (value: Error) => void); 19 | } 20 | 21 | export type ChangesType = "Document" | "Index" | "Operation" | "Counter" | "TimeSeries" | "AggressiveCache"; 22 | -------------------------------------------------------------------------------- /src/Documents/Changes/IChangesObservable.ts: -------------------------------------------------------------------------------- 1 | export interface IChangesObservable extends IObservable { 2 | ensureSubscribedNow(): Promise; 3 | } 4 | 5 | export interface IObservable { 6 | on(event: "data", handler: (value: T) => void): this; 7 | 8 | on(event: "error", handler: (error: Error) => void): this; 9 | 10 | off(event: "data", handler: (value: T) => void): this; 11 | 12 | off(event: "error", handler: (error: Error) => void): this; 13 | 14 | removeListener(event: "data", handler: (value: T) => void): this; 15 | 16 | removeListener(event: "error", handler: (error: Error) => void): this; 17 | } 18 | -------------------------------------------------------------------------------- /src/Documents/Changes/IConnectableChanges.ts: -------------------------------------------------------------------------------- 1 | import { IDisposable } from "../../Types/Contracts.js"; 2 | 3 | export interface IConnectableChanges extends IDisposable { 4 | 5 | connected: boolean; 6 | 7 | ensureConnectedNow(): Promise; 8 | 9 | on(type: "connectionStatus", handler: () => void): void; 10 | on(type: "error", handler: (error: Error) => void): void; 11 | 12 | off(type: "connectionStatus", handler: () => void): void; 13 | off(type: "error", handler: (error: Error) => void): void; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Changes/ICounterChanges.ts: -------------------------------------------------------------------------------- 1 | import { IChangesObservable } from "./IChangesObservable.js"; 2 | 3 | export interface ICounterChanges { 4 | /** 5 | * Subscribe for changes for all counters. 6 | */ 7 | forAllCounters(): IChangesObservable; 8 | 9 | /** 10 | * Subscribe to changes for all counters with a given name. 11 | */ 12 | forCounter(counterName: string): IChangesObservable; 13 | 14 | /** 15 | * Subscribe to changes for counter from a given document and with given name. 16 | */ 17 | forCounterOfDocument(documentId: string, counterName: string): IChangesObservable; 18 | 19 | /** 20 | * Subscribe to changes for all counters from a given document. 21 | */ 22 | forCountersOfDocument(documentId: string): IChangesObservable; 23 | } -------------------------------------------------------------------------------- /src/Documents/Changes/IIndexChanges.ts: -------------------------------------------------------------------------------- 1 | import { IChangesObservable } from "./IChangesObservable.js"; 2 | 3 | 4 | export interface IIndexChanges { 5 | /** 6 | * Subscribe to changes for specified index only. 7 | */ 8 | forIndex(indexName: string): IChangesObservable; 9 | 10 | /** 11 | * Subscribe to changes for all indexes. 12 | */ 13 | forAllIndexes(): IChangesObservable; 14 | } -------------------------------------------------------------------------------- /src/Documents/Changes/IOperationChanges.ts: -------------------------------------------------------------------------------- 1 | import { IChangesObservable } from "./IChangesObservable.js"; 2 | 3 | export interface IOperationChanges { 4 | /** 5 | * Subscribe to changes for specified operation only. 6 | */ 7 | forOperationId(operationId: number): IChangesObservable; 8 | 9 | /** 10 | * Subscribe to change for all operation statuses. 11 | */ 12 | forAllOperations(): IChangesObservable; 13 | } -------------------------------------------------------------------------------- /src/Documents/Changes/IndexChange.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseChange } from "./DatabaseChange.js"; 2 | 3 | export interface IndexChange extends DatabaseChange { 4 | type: IndexChangeTypes; 5 | name: string; 6 | } 7 | 8 | export interface TopologyChange extends DatabaseChange { 9 | url: string; 10 | database: string; 11 | } 12 | 13 | export type IndexChangeTypes = 14 | "None" 15 | | "BatchCompleted" 16 | | "IndexAdded" 17 | | "IndexRemoved" 18 | | "IndexDemotedToIdle" 19 | | "IndexPromotedFromIdle" 20 | | "IndexDemotedToDisabled" 21 | | "IndexMarkedAsErrored" 22 | | "SideBySideReplace" 23 | | "Renamed" 24 | | "IndexPaused" 25 | | "LockModeChanged" 26 | | "PriorityChanged" 27 | | "RollingIndexChanged" 28 | ; 29 | -------------------------------------------------------------------------------- /src/Documents/Changes/OperationStatusChange.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseChange } from "./DatabaseChange.js"; 2 | 3 | export interface OperationStatusChange extends DatabaseChange { 4 | operationId: number; 5 | state: any; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Changes/TimeSeriesChange.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseChange } from "./DatabaseChange.js"; 2 | 3 | export type TimeSeriesChangeTypes = "None" | "Put" | "Delete" | "Mixed"; 4 | 5 | export interface TimeSeriesChange extends DatabaseChange { 6 | name: string; 7 | from: Date; 8 | to: Date; 9 | documentId: string; 10 | changeVector: string; 11 | type: TimeSeriesChangeTypes; 12 | collectionName: string; 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Commands/Batches/BatchOptions.ts: -------------------------------------------------------------------------------- 1 | import { ReplicationBatchOptions, IndexBatchOptions } from "../../Session/IAdvancedSessionOperations.js"; 2 | import { ShardedBatchOptions } from "./ShardedBatchOptions.js"; 3 | 4 | export interface BatchOptions { 5 | replicationOptions: ReplicationBatchOptions; 6 | indexOptions: IndexBatchOptions; 7 | shardedOptions?: ShardedBatchOptions; 8 | } 9 | -------------------------------------------------------------------------------- /src/Documents/Commands/Batches/DeleteCompareExchangeCommandData.ts: -------------------------------------------------------------------------------- 1 | import { ICommandData, CommandType } from "../CommandData.js"; 2 | import { DocumentConventions } from "../../Conventions/DocumentConventions.js"; 3 | 4 | export class DeleteCompareExchangeCommandData implements ICommandData { 5 | private readonly _index: number; 6 | public readonly id: string; 7 | public changeVector: string; 8 | public name: string; 9 | 10 | public constructor(key: string, index: number) { 11 | this.id = key; 12 | this._index = index; 13 | } 14 | 15 | public get type(): CommandType { 16 | return "CompareExchangePUT"; 17 | } 18 | 19 | public serialize(conventions: DocumentConventions): object { 20 | return { 21 | Id: this.id, 22 | Index: this._index, 23 | Type: "CompareExchangeDELETE" as CommandType 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Documents/Commands/Batches/ForceRevisionCommandData.ts: -------------------------------------------------------------------------------- 1 | import { CommandType, ICommandData } from "../CommandData.js"; 2 | import { throwError } from "../../../Exceptions/index.js"; 3 | import { DocumentConventions } from "../../Conventions/DocumentConventions.js"; 4 | 5 | export class ForceRevisionCommandData implements ICommandData { 6 | public id: string; 7 | public name: string; 8 | public changeVector: string; 9 | public type: CommandType = "ForceRevisionCreation"; 10 | 11 | public constructor(id: string) { 12 | if (!id) { 13 | throwError("InvalidArgumentException", "Id cannot be null"); 14 | } 15 | 16 | this.id = id; 17 | } 18 | 19 | public serialize(conventions: DocumentConventions): object { 20 | return { 21 | Id: this.id, 22 | Type: this.type 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Documents/Commands/Batches/IncrementalTimeSeriesBatchCommandData.ts: -------------------------------------------------------------------------------- 1 | import { CommandType } from "../CommandData.js"; 2 | import { TimeSeriesCommandData } from "./TimeSeriesCommandData.js"; 3 | import { IncrementOperation } from "../../Operations/TimeSeries/TimeSeriesOperation.js"; 4 | 5 | 6 | export class IncrementalTimeSeriesBatchCommandData extends TimeSeriesCommandData { 7 | 8 | public constructor(documentId: string, name: string, increments: IncrementOperation[]) { 9 | super(documentId, name); 10 | 11 | if (increments) { 12 | for (const incrementOperation of increments) { 13 | this.timeSeries.increment(incrementOperation); 14 | } 15 | } 16 | } 17 | 18 | public get type(): CommandType { 19 | return "TimeSeriesWithIncrements"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Documents/Commands/Batches/PutAttachmentCommandHelper.ts: -------------------------------------------------------------------------------- 1 | import { throwError } from "../../../Exceptions/index.js"; 2 | 3 | export class PutAttachmentCommandHelper { 4 | public static throwStreamWasAlreadyUsed(): void { 5 | throwError("InvalidOperationException", 6 | "It is forbidden to re-use the same InputStream for more than one attachment. " 7 | + "Use a unique InputStream per put attachment command."); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Commands/Batches/ShardedBatchOptions.ts: -------------------------------------------------------------------------------- 1 | import { ShardedBatchBehavior } from "../../Session/ShardedBatchBehavior.js"; 2 | 3 | 4 | export interface ShardedBatchOptions { 5 | batchBehavior: ShardedBatchBehavior; 6 | } 7 | 8 | export function forBehavior(behavior: ShardedBatchBehavior): ShardedBatchOptions { 9 | switch (behavior) { 10 | case "Default": 11 | return null; 12 | case "TransactionalSingleBucketOnly": 13 | return { 14 | batchBehavior: "TransactionalSingleBucketOnly" 15 | } 16 | case "NonTransactionalMultiBucket": 17 | return { 18 | batchBehavior: "NonTransactionalMultiBucket" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Documents/Commands/DocumentSizeDetails.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface DocumentSizeDetails { 3 | docId: string; 4 | actualSize: number; 5 | humaneActualSize: string; 6 | allocatedSize: number; 7 | humaneAllocatedSize: string; 8 | } -------------------------------------------------------------------------------- /src/Documents/Commands/GetConflictsResult.ts: -------------------------------------------------------------------------------- 1 | export interface GetConflictsResult { 2 | id: string; 3 | results: Conflict[]; 4 | largestEtag: number; 5 | totalResults: number; 6 | } 7 | 8 | export interface Conflict { 9 | lastModified: Date; 10 | changeVector: string; 11 | doc: object; 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Commands/StreamResult.ts: -------------------------------------------------------------------------------- 1 | export interface StreamResult { 2 | id: string; 3 | changeVector: string; 4 | metadata: object; 5 | document: T; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Commands/StreamResultResponse.ts: -------------------------------------------------------------------------------- 1 | import { Readable } from "node:stream"; 2 | import { HttpResponse } from "../../Primitives/Http.js"; 3 | 4 | export interface StreamResultResponse { 5 | response: HttpResponse; 6 | stream: Readable; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Conventions/BulkInsertConventions.ts: -------------------------------------------------------------------------------- 1 | import { throwError } from "../../Exceptions/index.js"; 2 | 3 | export class BulkInsertConventions { 4 | private readonly _notFrozen: () => void; 5 | private _timeSeriesBatchSize: number; 6 | 7 | constructor(notFrozen: () => void) { 8 | this._timeSeriesBatchSize = 1024; 9 | this._notFrozen = notFrozen; 10 | } 11 | 12 | public get timeSeriesBatchSize() { 13 | return this._timeSeriesBatchSize; 14 | } 15 | 16 | public set timeSeriesBatchSize(batchSize: number) { 17 | this._notFrozen(); 18 | 19 | if (batchSize <= 0) { 20 | throwError("InvalidArgumentException", "BatchSize must be positive"); 21 | } 22 | 23 | this._timeSeriesBatchSize = batchSize; 24 | } 25 | } -------------------------------------------------------------------------------- /src/Documents/Conventions/ShardingConventions.ts: -------------------------------------------------------------------------------- 1 | import { DocumentConventions } from "./DocumentConventions.js"; 2 | import { ShardedBatchBehavior } from "../Session/ShardedBatchBehavior.js"; 3 | 4 | export class ShardingConventions { 5 | private readonly _conventions: DocumentConventions; 6 | 7 | private _batchBehavior: ShardedBatchBehavior; 8 | 9 | 10 | get batchBehavior(): ShardedBatchBehavior { 11 | return this._batchBehavior; 12 | } 13 | 14 | set batchBehavior(value: ShardedBatchBehavior) { 15 | this._conventions._assertNotFrozen(); 16 | this._batchBehavior = value; 17 | } 18 | 19 | public constructor(conventions: DocumentConventions) { 20 | this._conventions = conventions; 21 | this._batchBehavior = "Default"; 22 | } 23 | } -------------------------------------------------------------------------------- /src/Documents/DataArchival/ArchivedDataProcessingBehavior.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export type ArchivedDataProcessingBehavior = 4 | "ExcludeArchived" 5 | | "IncludeArchived" 6 | | "ArchivedOnly"; -------------------------------------------------------------------------------- /src/Documents/DocumentAbstractions.ts: -------------------------------------------------------------------------------- 1 | import { ObjectLiteralDescriptor, EntityConstructor } from "../Types/index.js"; 2 | 3 | export type DocumentType = 4 | EntityConstructor | ObjectLiteralDescriptor | string; 5 | -------------------------------------------------------------------------------- /src/Documents/Identity/HiloDocument.ts: -------------------------------------------------------------------------------- 1 | export interface HiloDocument { 2 | max: number; 3 | } -------------------------------------------------------------------------------- /src/Documents/Identity/HiloRangeValue.ts: -------------------------------------------------------------------------------- 1 | export class HiloRangeValue { 2 | private readonly _minId: number; 3 | private readonly _maxId: number; 4 | private readonly _serverTag: string; 5 | private _current: number; 6 | 7 | constructor(minId: number = 1, maxId: number = 0, serverTag: string) { 8 | this._minId = minId; 9 | this._maxId = maxId; 10 | this._current = minId - 1; 11 | this._serverTag = serverTag; 12 | } 13 | 14 | public get minId(): number { 15 | return this._minId; 16 | } 17 | 18 | public get maxId(): number { 19 | return this._maxId; 20 | } 21 | 22 | public get current(): number { 23 | return this._current; 24 | } 25 | 26 | public get serverTag(): string { 27 | return this._serverTag; 28 | } 29 | 30 | public increment(): number { 31 | return ++this._current; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Documents/Identity/IHiLoIdGenerator.ts: -------------------------------------------------------------------------------- 1 | import { ObjectTypeDescriptor } from "../../Types/index.js"; 2 | 3 | 4 | export interface IHiLoIdGenerator { 5 | generateNextIdFor(database: string, collectionName: string): Promise; 6 | generateNextIdFor(database: string, documentType: ObjectTypeDescriptor): Promise; 7 | generateNextIdFor(database: string, entity: object): Promise; 8 | generateDocumentId(database: string, entity: object): Promise; 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Identity/NextId.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface NextId { 4 | id: number; 5 | serverTag: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Indexes/Analysis/AnalyzerDefinition.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface AnalyzerDefinition { 3 | name: string; 4 | code: string; 5 | } -------------------------------------------------------------------------------- /src/Documents/Indexes/AutoIndexDefinition.ts: -------------------------------------------------------------------------------- 1 | import { IndexType } from "./Enums.js"; 2 | import { AutoIndexFieldOptions } from "./AutoIndexFieldOptions.js"; 3 | import { IndexDefinitionBase } from "./IndexDefinitionBase.js"; 4 | 5 | 6 | export interface AutoIndexDefinition extends IndexDefinitionBase { 7 | type: IndexType; 8 | collection: string; 9 | mapFields: Record; 10 | groupByFields: Record; 11 | groupByFieldNames: string[]; 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Indexes/AutoIndexFieldOptions.ts: -------------------------------------------------------------------------------- 1 | import { AggregationOperation, AutoFieldIndexing, FieldStorage, GroupByArrayBehavior } from "./Enums.js"; 2 | import { AutoSpatialOptions } from "./Spatial/AutoSpatialOptions.js"; 3 | 4 | export interface AutoIndexFieldOptions { 5 | storage: FieldStorage; 6 | indexing: AutoFieldIndexing; 7 | aggregation: AggregationOperation; 8 | spatial: AutoSpatialOptions; 9 | groupByArrayBehavior: GroupByArrayBehavior; 10 | suggestions: boolean; 11 | isNameQuoted: boolean; 12 | } -------------------------------------------------------------------------------- /src/Documents/Indexes/Counters/CountersIndexDefinition.ts: -------------------------------------------------------------------------------- 1 | import { IndexDefinition } from "../IndexDefinition.js"; 2 | import { IndexSourceType } from "../IndexSourceType.js"; 3 | 4 | export class CountersIndexDefinition extends IndexDefinition { 5 | 6 | public get sourceType(): IndexSourceType { 7 | return "Counters"; 8 | } 9 | } -------------------------------------------------------------------------------- /src/Documents/Indexes/Errors.ts: -------------------------------------------------------------------------------- 1 | export interface IndexErrors { 2 | name: string; 3 | errors: IndexingError[]; 4 | } 5 | 6 | export interface IndexingError { 7 | error: string; 8 | timestamp: Date; 9 | document: string; 10 | action: string; 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Indexes/IAbstractIndexCreationTask.ts: -------------------------------------------------------------------------------- 1 | import { IndexPriority, IndexState } from "./Enums.js"; 2 | import { DocumentConventions } from "../Conventions/DocumentConventions.js"; 3 | import { IndexDefinition } from "./IndexDefinition.js"; 4 | import { IDocumentStore } from "../IDocumentStore.js"; 5 | import { IndexDeploymentMode } from "./IndexDeploymentMode.js"; 6 | 7 | export interface IAbstractIndexCreationTask { 8 | 9 | getIndexName(): string; 10 | priority: IndexPriority; 11 | state: IndexState; 12 | deploymentMode: IndexDeploymentMode; 13 | conventions: DocumentConventions; 14 | 15 | createIndexDefinition(): IndexDefinition; 16 | 17 | execute(store: IDocumentStore): Promise; 18 | execute(store: IDocumentStore, conventions: DocumentConventions): Promise; 19 | execute(store: IDocumentStore, conventions: DocumentConventions, database: string): Promise; 20 | } -------------------------------------------------------------------------------- /src/Documents/Indexes/IndexDefinitionBase.ts: -------------------------------------------------------------------------------- 1 | import { IndexPriority, IndexState } from "./Enums.js"; 2 | 3 | 4 | export abstract class IndexDefinitionBase { 5 | public name: string; 6 | public priority: IndexPriority; 7 | public state: IndexState; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Indexes/IndexDeploymentMode.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export type IndexDeploymentMode = 4 | "Parallel" 5 | | "Rolling"; -------------------------------------------------------------------------------- /src/Documents/Indexes/IndexFieldOptions.ts: -------------------------------------------------------------------------------- 1 | import { SpatialOptions } from "./Spatial.js"; 2 | import { FieldStorage, FieldIndexing, FieldTermVector } from "./Enums.js"; 3 | 4 | export class IndexFieldOptions { 5 | public storage: FieldStorage; 6 | public indexing: FieldIndexing; 7 | public termVector: FieldTermVector; 8 | public spatial: SpatialOptions; 9 | public analyzer: string; 10 | public suggestions: boolean; 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Indexes/IndexSourceType.ts: -------------------------------------------------------------------------------- 1 | 2 | export type IndexSourceType = "None" | "Documents" | "TimeSeries" | "Counters"; -------------------------------------------------------------------------------- /src/Documents/Indexes/IndexingStatus.ts: -------------------------------------------------------------------------------- 1 | export type IndexRunningStatus = "Running" | "Paused" | "Disabled" | "Pending"; 2 | 3 | export interface IndexingStatus { 4 | status: IndexRunningStatus; 5 | indexes: IndexStatus[]; 6 | } 7 | 8 | export interface IndexStatus { 9 | name: string; 10 | status: IndexRunningStatus; 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Indexes/LuceneIndexInputType.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export type LuceneIndexInputType = "Standard" | "Buffered"; 4 | -------------------------------------------------------------------------------- /src/Documents/Indexes/RollingIndex.ts: -------------------------------------------------------------------------------- 1 | import { RollingIndexDeployment } from "./RollingIndexDeployment.js"; 2 | 3 | export interface RollingIndex { 4 | activeDeployments: Record; 5 | raftCommandIndex: number; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Indexes/RollingIndexDeployment.ts: -------------------------------------------------------------------------------- 1 | import { RollingIndexState } from "./RollingIndexState.js"; 2 | 3 | export interface RollingIndexDeployment { 4 | state: RollingIndexState; 5 | createdAt: Date; 6 | startedAt: Date; 7 | finishedAt: Date; 8 | } -------------------------------------------------------------------------------- /src/Documents/Indexes/RollingIndexState.ts: -------------------------------------------------------------------------------- 1 | 2 | export type RollingIndexState = 3 | "Pending" 4 | | "Running" 5 | | "Done"; -------------------------------------------------------------------------------- /src/Documents/Indexes/Spatial/AutoSpatialOptions.ts: -------------------------------------------------------------------------------- 1 | import { AutoSpatialMethodType } from "../Enums.js"; 2 | import { SpatialOptions } from "../Spatial.js"; 3 | 4 | export interface AutoSpatialOptions extends SpatialOptions { 5 | methodType: AutoSpatialMethodType; 6 | methodArguments: string[]; 7 | } -------------------------------------------------------------------------------- /src/Documents/Indexes/TimeSeries/TimeSeriesIndexDefinition.ts: -------------------------------------------------------------------------------- 1 | import { IndexDefinition } from "../IndexDefinition.js"; 2 | import { IndexSourceType } from "../IndexSourceType.js"; 3 | 4 | export class TimeSeriesIndexDefinition extends IndexDefinition { 5 | get sourceType(): IndexSourceType { 6 | return "TimeSeries"; 7 | } 8 | } -------------------------------------------------------------------------------- /src/Documents/Indexes/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./AbstractCsharpIndexCreationTask.js"; 2 | export * from "./AbstractCsharpMultiMapIndexCreationTask.js"; 3 | export * from "./Counters/AbstractCsharpCountersIndexCreationTask.js"; 4 | export * from "./Counters/AbstractRawJavaScriptCountersIndexCreationTask.js"; -------------------------------------------------------------------------------- /src/Documents/Lazy.ts: -------------------------------------------------------------------------------- 1 | export class Lazy { 2 | 3 | private readonly _valueFactory: () => Promise; 4 | private _value: Promise; 5 | 6 | public constructor(valueFactory: () => Promise) { 7 | this._valueFactory = valueFactory; 8 | } 9 | 10 | public isValueCreated(): boolean { 11 | return !!this._value; 12 | } 13 | 14 | public async getValue(): Promise { 15 | if (this._value) { 16 | return this._value; 17 | } 18 | 19 | this._value = this._valueFactory(); 20 | return this._value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Documents/Operations/AbstractDatabaseStatistics.ts: -------------------------------------------------------------------------------- 1 | import { EssentialIndexInformation } from "./EssentialIndexInformation.js"; 2 | 3 | export interface AbstractDatabaseStatistics { 4 | countOfIndexes: number; 5 | countOfDocuments: number; 6 | countOfRevisionDocuments: number; 7 | countOfDocumentsConflicts: number; 8 | countOfTombstones: number; 9 | countOfConflicts: number; 10 | countOfAttachments: number; 11 | countOfCounterEntries: number; 12 | countOfTimeSeriesSegments: number; 13 | indexes: TIndexInformation[]; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Operations/Attachments/AttachmentRequest.ts: -------------------------------------------------------------------------------- 1 | import { StringUtil } from "../../../Utility/StringUtil.js"; 2 | import { throwError } from "../../../Exceptions/index.js"; 3 | 4 | export class AttachmentRequest { 5 | private readonly _name: string; 6 | private readonly _documentId: string; 7 | 8 | public constructor(documentId: string, name: string) { 9 | if (StringUtil.isNullOrWhitespace(documentId)) { 10 | throwError("InvalidArgumentException", "DocumentId cannot be null or whitespace"); 11 | } 12 | 13 | if (StringUtil.isNullOrWhitespace(name)) { 14 | throwError("InvalidArgumentException", "Name cannot be null or whitespace"); 15 | } 16 | 17 | this._documentId = documentId; 18 | this._name = name; 19 | } 20 | 21 | public get name() { 22 | return this._name; 23 | } 24 | 25 | public get documentId() { 26 | return this._documentId; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/AbstractGetPeriodicBackupStatusOperationResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface AbstractGetPeriodicBackupStatusOperationResult { 3 | isSharded: boolean; 4 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/AmazonSettings.ts: -------------------------------------------------------------------------------- 1 | import { BackupSettings } from "./BackupSettings.js"; 2 | 3 | export interface AmazonSettings extends BackupSettings { 4 | awsAccessKey: string; 5 | awsSecretKey: string; 6 | awsSessionToken: string; 7 | awsRegionName: string; 8 | remoteFolderName: string; 9 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/AzureSettings.ts: -------------------------------------------------------------------------------- 1 | import { BackupSettings } from "./BackupSettings.js"; 2 | 3 | export interface AzureSettings extends BackupSettings { 4 | storageContainer?: string; 5 | remoteFolderName?: string; 6 | accountName?: string; 7 | accountKey?: string; 8 | sasToken?: string; 9 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/BackupEncryptionSettings.ts: -------------------------------------------------------------------------------- 1 | import { EncryptionMode } from "./Enums.js"; 2 | 3 | export interface BackupEncryptionSettings { 4 | key: string; 5 | encryptionMode: EncryptionMode; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/BackupSettings.ts: -------------------------------------------------------------------------------- 1 | import { GetBackupConfigurationScript } from "./GetBackupConfigurationScript.js"; 2 | 3 | export interface BackupSettings { 4 | disabled?: boolean; 5 | getBackupConfigurationScript?: GetBackupConfigurationScript; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/BackupTaskType.ts: -------------------------------------------------------------------------------- 1 | 2 | export type BackupTaskType = "Periodic" | "OneTime"; -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/CompressionLevel.ts: -------------------------------------------------------------------------------- 1 | 2 | export type CompressionLevel = 3 | "Optimal" 4 | | "Fastest" 5 | | "NoCompression"; -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/Enums.ts: -------------------------------------------------------------------------------- 1 | 2 | export type BackupType = 3 | "Backup" 4 | | "Snapshot"; 5 | 6 | export type BackupUploadMode = 7 | "Default" 8 | | "DirectUpload"; 9 | 10 | export type EncryptionMode = 11 | "None" 12 | | "UseDatabaseKey" 13 | | "UseProvidedKey"; 14 | 15 | 16 | export type SnapshotBackupCompressionAlgorithm = 17 | "Zstd" 18 | | "Deflate"; -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/FtpSettings.ts: -------------------------------------------------------------------------------- 1 | import { BackupSettings } from "./BackupSettings.js"; 2 | 3 | export interface FtpSettings extends BackupSettings { 4 | url: string; 5 | userName?: string; 6 | password?: string; 7 | certificateAsBase64?: string; 8 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/GetBackupConfigurationScript.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface GetBackupConfigurationScript { 3 | exec: string; 4 | arguments: string; 5 | timeoutInMs: number; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/GetPeriodicBackupStatusOperationResult.ts: -------------------------------------------------------------------------------- 1 | import { PeriodicBackupStatus } from "./PeriodicBackupStatus.js"; 2 | import { AbstractGetPeriodicBackupStatusOperationResult } from "./AbstractGetPeriodicBackupStatusOperationResult.js"; 3 | 4 | export interface GetPeriodicBackupStatusOperationResult extends AbstractGetPeriodicBackupStatusOperationResult { 5 | status: PeriodicBackupStatus; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/GlacierSettings.ts: -------------------------------------------------------------------------------- 1 | import { AmazonSettings } from "./AmazonSettings.js"; 2 | 3 | export interface GlacierSettings extends AmazonSettings { 4 | vaultName: string; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/GoogleCloudSettings.ts: -------------------------------------------------------------------------------- 1 | import { BackupSettings } from "./BackupSettings.js"; 2 | 3 | export interface GoogleCloudSettings extends BackupSettings { 4 | 5 | bucketName: string; 6 | remoteFolderName: string; 7 | googleCredentialsJson: string; 8 | 9 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/LastRaftIndex.ts: -------------------------------------------------------------------------------- 1 | export interface LastRaftIndex { 2 | lastEtag: number; 3 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/LocalSettings.ts: -------------------------------------------------------------------------------- 1 | import { BackupSettings } from "./BackupSettings.js"; 2 | 3 | export interface LocalSettings extends BackupSettings { 4 | folderPath: string; 5 | shardNumber?: number; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/PeriodicBackupConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { RetentionPolicy } from "./RetentionPolicy.js"; 2 | import { BackupConfiguration } from "./BackupConfiguration.js"; 3 | 4 | export interface PeriodicBackupConfiguration extends BackupConfiguration { 5 | name?: string; 6 | taskId?: number; 7 | disabled?: boolean; 8 | mentorNode?: string; 9 | retentionPolicy?: RetentionPolicy; 10 | createdAt?: string; 11 | 12 | fullBackupFrequency?: string; 13 | incrementalBackupFrequency?: string; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/RestoreBackupConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { RestoreBackupConfigurationBase } from "./RestoreBackupConfigurationBase.js"; 2 | 3 | export interface RestoreBackupConfiguration extends RestoreBackupConfigurationBase { 4 | backupLocation: string; 5 | 6 | type: "Local"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/RestoreBackupConfigurationBase.ts: -------------------------------------------------------------------------------- 1 | import { BackupEncryptionSettings } from "./BackupEncryptionSettings.js"; 2 | import { RestoreType } from "./RestoreType.js"; 3 | import { ShardedRestoreSettings } from "./Sharding/ShardedRestoreSettings.js"; 4 | 5 | export interface RestoreBackupConfigurationBase { 6 | databaseName: string; 7 | lastFileNameToRestore: string; 8 | dataDirectory: string; 9 | encryptionKey: string; 10 | disableOngoingTasks: boolean; 11 | skipIndexes: boolean; 12 | 13 | type: RestoreType; 14 | 15 | shardRestoreSettings: ShardedRestoreSettings; 16 | backupEncryptionSettings: BackupEncryptionSettings; 17 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/RestoreFromAzureConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { RestoreBackupConfigurationBase } from "./RestoreBackupConfigurationBase.js"; 2 | import { AzureSettings } from "./AzureSettings.js"; 3 | 4 | export interface RestoreFromAzureConfiguration extends RestoreBackupConfigurationBase { 5 | settings: AzureSettings; 6 | type: "Azure"; 7 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/RestoreFromGoogleCloudConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { RestoreBackupConfigurationBase } from "./RestoreBackupConfigurationBase.js"; 2 | import { GoogleCloudSettings } from "./GoogleCloudSettings.js"; 3 | 4 | export interface RestoreFromGoogleCloudConfiguration extends RestoreBackupConfigurationBase { 5 | settings: GoogleCloudSettings; 6 | type: "GoogleCloud"; 7 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/RestoreFromS3Configuration.ts: -------------------------------------------------------------------------------- 1 | import { RestoreBackupConfigurationBase } from "./RestoreBackupConfigurationBase.js"; 2 | import { S3Settings } from "./S3Settings.js"; 3 | 4 | export interface RestoreFromS3Configuration extends RestoreBackupConfigurationBase { 5 | settings: S3Settings; 6 | type: "S3"; 7 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/RestoreType.ts: -------------------------------------------------------------------------------- 1 | 2 | export type RestoreType = 3 | "Local" 4 | | "S3" 5 | | "Azure" 6 | | "GoogleCloud"; -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/RetentionPolicy.ts: -------------------------------------------------------------------------------- 1 | export class RetentionPolicy { 2 | disabled: boolean; 3 | minimumBackupAgeToKeep: string; 4 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/S3Settings.ts: -------------------------------------------------------------------------------- 1 | import { AmazonSettings } from "./AmazonSettings.js"; 2 | 3 | export interface S3Settings extends AmazonSettings { 4 | bucketName: string; 5 | customServerUrl: string; 6 | forcePathStyle: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/Sharding/ShardedRestoreSettings.ts: -------------------------------------------------------------------------------- 1 | import { SingleShardRestoreSetting } from "./SingleShardRestoreSetting.js"; 2 | 3 | export interface ShardedRestoreSettings { 4 | shards: Record; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/Sharding/SingleShardRestoreSetting.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface SingleShardRestoreSetting { 3 | shardNumber: number; 4 | nodeTag: string; 5 | folderName: string; 6 | lastFileNameToRestore: string; 7 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/StartBackupOperationResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export class StartBackupOperationResult { 3 | responsibleNode: string; 4 | operationId: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/UpdatePeriodicBackupOperationResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface UpdatePeriodicBackupOperationResult { 3 | raftCommandIndex: number; 4 | taskId: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/UploadProgress.ts: -------------------------------------------------------------------------------- 1 | import { UploadType } from "./BackupStatus.js"; 2 | import { UploadState } from "./UploadState.js"; 3 | 4 | export interface UploadProgress { 5 | uploadType: UploadType; 6 | uploadState: UploadState; 7 | uploadedInBytes: number; 8 | totalInBytes: number; 9 | bytesPutsPerSec: number; 10 | uploadTimeInMs: number; 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Operations/Backups/UploadState.ts: -------------------------------------------------------------------------------- 1 | export type UploadState = 2 | "PendingUpload" 3 | | "Uploading" 4 | | "PendingResponse" 5 | | "Done"; -------------------------------------------------------------------------------- /src/Documents/Operations/BulkInsertProgress.ts: -------------------------------------------------------------------------------- 1 | import { IOperationProgress } from "./IOperationProgress.js"; 2 | 3 | export interface BulkInsertProgress extends IOperationProgress { 4 | total: number; 5 | batchCount: number; 6 | lastProcessedId: string; 7 | 8 | documentsProcessed: number; 9 | attachmentsProcessed: number; 10 | countersProcessed: number; 11 | timeSeriesProcessed: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Operations/CollectionDetails.ts: -------------------------------------------------------------------------------- 1 | import { Size } from "../../Utility/SizeUtil.js"; 2 | 3 | export interface CollectionDetails { 4 | name: string; 5 | countOfDocuments: number; 6 | size: Size; 7 | documentsSize: Size; 8 | tombstonesSize: Size; 9 | revisionsSize: Size; 10 | } 11 | -------------------------------------------------------------------------------- /src/Documents/Operations/CollectionStatistics.ts: -------------------------------------------------------------------------------- 1 | export interface CollectionStatistics { 2 | countOfDocuments: number; 3 | countOfConflicts: number; 4 | collections: { [collection: string]: number }; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Operations/CompareExchange/CompareExchangeValueJsonConverter.ts: -------------------------------------------------------------------------------- 1 | import { TypeUtil } from "../../../Utility/TypeUtil.js"; 2 | import { DocumentConventions } from "../../Conventions/DocumentConventions.js"; 3 | import { EntityToJson } from "../../Session/EntityToJson.js"; 4 | 5 | export class CompareExchangeValueJsonConverter { 6 | public static convertToJson(value: object, conventions: DocumentConventions) { 7 | if (TypeUtil.isNullOrUndefined(value)) { 8 | return null; 9 | } 10 | 11 | if (TypeUtil.isPrimitive(value)) { 12 | return value; 13 | } 14 | 15 | return EntityToJson.convertEntityToJson(value, conventions); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Documents/Operations/CompareExchange/CompareExchangeValueState.ts: -------------------------------------------------------------------------------- 1 | 2 | export type CompareExchangeValueState = "None" | "Created" | "Deleted" | "Missing"; -------------------------------------------------------------------------------- /src/Documents/Operations/CompareExchange/ICompareExchangeValue.ts: -------------------------------------------------------------------------------- 1 | import { IMetadataDictionary } from "../../Session/IMetadataDictionary.js"; 2 | 3 | export interface ICompareExchangeValue { 4 | key: string; 5 | index: number; 6 | value: any; 7 | metadata: IMetadataDictionary; 8 | hasMetadata(): boolean; 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Operations/Configuration/ClientConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { ReadBalanceBehavior } from "../../../Http/ReadBalanceBehavior.js"; 2 | import { LoadBalanceBehavior } from "../../../Http/LoadBalanceBehavior.js"; 3 | 4 | export interface ClientConfiguration { 5 | identityPartsSeparator?: string; 6 | etag?: number; 7 | disabled?: boolean; 8 | maxNumberOfRequestsPerSession?: number; 9 | readBalanceBehavior?: ReadBalanceBehavior; 10 | loadBalanceBehavior?: LoadBalanceBehavior; 11 | loadBalancerContextSeed?: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Operations/Configuration/StudioConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { StudioEnvironment } from "./StudioEnvironment.js"; 2 | 3 | export interface StudioConfiguration { 4 | disabled: boolean; 5 | disableAutoIndexCreation: boolean; 6 | environment: StudioEnvironment; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/Documents/Operations/Configuration/StudioEnvironment.ts: -------------------------------------------------------------------------------- 1 | 2 | export type StudioEnvironment = 3 | "None" 4 | | "Development" 5 | | "Testing" 6 | | "Production"; -------------------------------------------------------------------------------- /src/Documents/Operations/Counters/CounterBatch.ts: -------------------------------------------------------------------------------- 1 | import { DocumentCountersOperation } from "./DocumentCountersOperation.js"; 2 | 3 | export class CounterBatch { 4 | public replyWithAllNodesValues: boolean; 5 | public documents: DocumentCountersOperation[] = []; 6 | public fromEtl: boolean; 7 | 8 | public serialize(): object { 9 | return { 10 | ReplyWithAllNodesValues: this.replyWithAllNodesValues, 11 | Documents: this.documents.map(x => x.serialize()), 12 | FromEtl: this.fromEtl 13 | }; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Documents/Operations/Counters/CounterDetail.ts: -------------------------------------------------------------------------------- 1 | export interface CounterDetail { 2 | documentId: string; 3 | counterName: string; 4 | totalValue: number; 5 | etag?: number; 6 | counterValues?: { [key: string]: number }; 7 | changeVector?: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/Documents/Operations/Counters/CounterOperationType.ts: -------------------------------------------------------------------------------- 1 | export type CounterOperationType = 2 | "None" 3 | | "Increment" 4 | | "Delete" 5 | | "Get" 6 | | "Put" 7 | | "GetAll"; 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/Counters/CountersDetail.ts: -------------------------------------------------------------------------------- 1 | import { CounterDetail } from "./CounterDetail.js"; 2 | 3 | export interface CountersDetail { 4 | counters: CounterDetail[]; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Operations/Counters/DocumentCountersOperation.ts: -------------------------------------------------------------------------------- 1 | import { CounterOperation } from "./CounterOperation.js"; 2 | 3 | export class DocumentCountersOperation { 4 | public operations: CounterOperation[]; 5 | 6 | public documentId: string; 7 | 8 | public serialize(): object { 9 | const result = { 10 | DocumentId: this.documentId, 11 | Operations: this.operations.map(op => op.serialize()) 12 | }; 13 | 14 | return result; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Documents/Operations/DataArchival/ConfigureDataArchivalOperationResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ConfigureDataArchivalOperationResult { 3 | raftCommandIndex: number; 4 | } -------------------------------------------------------------------------------- /src/Documents/Operations/DataArchival/DataArchivalConfiguration.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface DataArchivalConfiguration { 3 | disabled: boolean; 4 | archiveFrequencyInSec: number; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/DatabaseStatistics.ts: -------------------------------------------------------------------------------- 1 | import { IndexInformation } from "./IndexInformation.js"; 2 | import { Size } from "../../Utility/SizeUtil.js"; 3 | import { AbstractDatabaseStatistics } from "./AbstractDatabaseStatistics.js"; 4 | 5 | export interface DatabaseStatistics extends AbstractDatabaseStatistics { 6 | lastDocEtag: number; 7 | lastDatabaseEtag: number; 8 | countOfUniqueAttachments: number; 9 | 10 | databaseChangeVector: string; 11 | databaseId: string; 12 | pager: string; 13 | is64Bit: string; 14 | lastIndexingTime: Date; 15 | sizeOnDisk: Size; 16 | tempBuffersSizeOnDisk: Size; 17 | numberOfTransactionMergerQueueOperations: number; 18 | } 19 | -------------------------------------------------------------------------------- /src/Documents/Operations/DetailedCollectionStatistics.ts: -------------------------------------------------------------------------------- 1 | import { CollectionDetails } from "./CollectionDetails.js"; 2 | 3 | export interface DetailedCollectionStatistics { 4 | countOfDocuments: number; 5 | countOfConflicts: number; 6 | collections: Record; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/DetailedDatabaseStatistics.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseStatistics } from "./DatabaseStatistics.js"; 2 | 3 | export interface DetailedDatabaseStatistics extends DatabaseStatistics { 4 | countOfIdentities: number; 5 | countOfCompareExchange: number; 6 | countOfCompareExchangeTombstones: number; 7 | countOfTimeSeriesDeletedRanges: number; 8 | } 9 | -------------------------------------------------------------------------------- /src/Documents/Operations/DisableDatabaseToggleResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface DisableDatabaseToggleResult { 3 | disabled: boolean; 4 | name: string; 5 | success: boolean; 6 | reason: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/EssentialDatabaseStatistics.ts: -------------------------------------------------------------------------------- 1 | import { AbstractDatabaseStatistics } from "./AbstractDatabaseStatistics.js"; 2 | import { EssentialIndexInformation } from "./EssentialIndexInformation.js"; 3 | 4 | export interface EssentialDatabaseStatistics extends AbstractDatabaseStatistics { 5 | 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/EssentialIndexInformation.ts: -------------------------------------------------------------------------------- 1 | import { IndexLockMode, IndexPriority, IndexType } from "../Indexes/Enums.js"; 2 | import { IndexSourceType } from "../Indexes/IndexSourceType.js"; 3 | import { ArchivedDataProcessingBehavior } from "../DataArchival/ArchivedDataProcessingBehavior.js"; 4 | 5 | export interface EssentialIndexInformation { 6 | name: string; 7 | lockMode: IndexLockMode; 8 | priority: IndexPriority; 9 | type: IndexType; 10 | sourceType: IndexSourceType; 11 | archivedDataProcessingBehavior: ArchivedDataProcessingBehavior; 12 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/ElasticSearch/ElasticSearchIndex.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ElasticSearchIndex { 3 | indexName: string; 4 | documentIdProperty: string; 5 | insertOnlyMode: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/Olap/OlapEtlFileFormat.ts: -------------------------------------------------------------------------------- 1 | 2 | export type OlapEtlFileFormat = "Parquet"; -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/Olap/OlapEtlTable.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface OlapEtlTable { 3 | tableName: string; 4 | documentIdColumn: string; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/Queue/EtlQueue.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface EtlQueue { 3 | name: string; 4 | deleteProcessedDocuments: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/Queue/KafkaConnectionSettings.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface KafkaConnectionSettings { 3 | bootstrapServers: string; 4 | connectionOptions?: Record; 5 | useRavenCertificate?: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/Queue/RabbitMqConnectionSettings.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface RabbitMqConnectionSettings { 3 | connectionString: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/RavenEtlConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { EtlConfiguration } from "./EtlConfiguration.js"; 2 | import { RavenConnectionString, EtlType } from "./ConnectionString.js"; 3 | import { DocumentConventions } from "../../Conventions/DocumentConventions.js"; 4 | 5 | export class RavenEtlConfiguration extends EtlConfiguration { 6 | public loadRequestTimeoutInSec: number; 7 | 8 | public get etlType(): EtlType { 9 | return "Raven"; 10 | } 11 | 12 | serialize(conventions: DocumentConventions): object { 13 | const result = super.serialize(conventions) as any; 14 | result.EtlType = this.etlType; 15 | return result; 16 | } 17 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/Sql/SqlEtlTable.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface SqlEtlTable { 3 | tableName: string; 4 | documentIdColumn: string; 5 | insertOnlyMode: boolean; 6 | } 7 | 8 | export function serializeSqlEtlTable(table: SqlEtlTable): object { 9 | return { 10 | TableName: table.tableName, 11 | DocumentIdColumn: table.documentIdColumn, 12 | InsertOnlyMode: table.insertOnlyMode 13 | } 14 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Etl/Transformation.ts: -------------------------------------------------------------------------------- 1 | 2 | export class Transformation { 3 | name: string; 4 | disabled?: boolean; 5 | collections?: string[]; 6 | applyToAllDocuments?: boolean; 7 | script?: string; 8 | documentIdPostfix?: string; 9 | } 10 | 11 | export function serializeTransformation(transformation: Transformation) { 12 | return { 13 | Name: transformation.name, 14 | Disabled: transformation.disabled, 15 | Collections: transformation.collections, 16 | ApplyToAllDocuments: transformation.applyToAllDocuments, 17 | Script: transformation.script 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Documents/Operations/Expiration/ExpirationConfiguration.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ExpirationConfiguration { 3 | disabled: boolean; 4 | deleteFrequencyInSec: number; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/GetServerWideBackupConfigurationsResponse.ts: -------------------------------------------------------------------------------- 1 | import { ServerWideBackupConfiguration } from "../../ServerWide/Operations/Configuration/ServerWideBackupConfiguration.js"; 2 | 3 | export interface GetServerWideBackupConfigurationsResponse { 4 | results: ServerWideBackupConfiguration[]; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/GetServerWideExternalReplicationsResponse.ts: -------------------------------------------------------------------------------- 1 | import { ServerWideExternalReplication } from "../../ServerWide/Operations/OngoingTasks/ServerWideExternalReplication.js"; 2 | 3 | export interface GetServerWideExternalReplicationsResponse { 4 | results: ServerWideExternalReplication[]; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/IOperationProgress.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 2 | export interface IOperationProgress { 3 | } 4 | -------------------------------------------------------------------------------- /src/Documents/Operations/IOperationResult.ts: -------------------------------------------------------------------------------- 1 | export interface IOperationResult { 2 | message: string; 3 | } -------------------------------------------------------------------------------- /src/Documents/Operations/IShardedOperationProgress.ts: -------------------------------------------------------------------------------- 1 | import { IOperationProgress } from "./IOperationProgress.js"; 2 | 3 | export interface IShardedOperationProgress extends IOperationProgress { 4 | shardNumber: number; 5 | nodeTag: string; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/IndexInformation.ts: -------------------------------------------------------------------------------- 1 | import { IndexState } from "../Indexes/Enums.js"; 2 | import { EssentialIndexInformation } from "./EssentialIndexInformation.js"; 3 | 4 | export interface IndexInformation extends EssentialIndexInformation { 5 | isStale: boolean; 6 | state: IndexState; 7 | lastIndexingTime: Date; 8 | } 9 | -------------------------------------------------------------------------------- /src/Documents/Operations/IndexOptimizeResult.ts: -------------------------------------------------------------------------------- 1 | import { IOperationResult } from "./IOperationResult.js"; 2 | 3 | export interface IndexOptimizeResult extends IOperationResult { 4 | indexName: string; 5 | message: string; 6 | shouldPersist: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/OngoingTasks/NextBackup.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface NextBackup { 3 | timeSpan: string; 4 | dateTime: Date; 5 | isFull: boolean; 6 | originalBackupTime: Date; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/OngoingTasks/OngoingTaskPullReplicationAsHub.ts: -------------------------------------------------------------------------------- 1 | import { OngoingTask } from "./OngoingTask.js"; 2 | 3 | export interface OngoingTaskPullReplicationAsHub extends OngoingTask { 4 | taskType: "PullReplicationAsHub"; 5 | 6 | destinationUrl: string; 7 | destinationDatabase: string; 8 | delayReplicationFor: string; 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Operations/OngoingTasks/OngoingTaskPullReplicationAsSink.ts: -------------------------------------------------------------------------------- 1 | import { OngoingTask } from "./OngoingTask.js"; 2 | import { PullReplicationMode } from "../Replication/PullReplicationMode.js"; 3 | 4 | 5 | export interface OngoingTaskPullReplicationAsSink extends OngoingTask { 6 | taskType: "PullReplicationAsSink"; 7 | 8 | hubName: string; 9 | mode: PullReplicationMode; 10 | destinationUrl: string; 11 | topologyDiscoveryUrls: string[]; 12 | destinationDatabase: string; 13 | connectionStringName: string; 14 | certificatePublicKey: string; 15 | accessName: string; 16 | allowedHubToSinkPaths: string[]; 17 | allowedSinkToHubPaths: string[]; 18 | } -------------------------------------------------------------------------------- /src/Documents/Operations/OngoingTasks/OngoingTaskType.ts: -------------------------------------------------------------------------------- 1 | 2 | export type OngoingTaskType = 3 | "Replication" 4 | | "RavenEtl" 5 | | "SqlEtl" 6 | | "OlapEtl" 7 | | "ElasticSearchEtl" 8 | | "QueueEtl" 9 | | "Backup" 10 | | "Subscription" 11 | | "PullReplicationAsHub" 12 | | "PullReplicationAsSink" 13 | | "QueueSink"; 14 | -------------------------------------------------------------------------------- /src/Documents/Operations/OngoingTasks/RunningBackup.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface RunningBackup { 3 | startTime: Date; 4 | isFull: boolean; 5 | runningBackupTaskId: number; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Operations/PatchResult.ts: -------------------------------------------------------------------------------- 1 | import { PatchResultBase } from "./PatchResultBase.js"; 2 | 3 | export class PatchResult extends PatchResultBase { 4 | public originalDocument: object; 5 | public debug: object; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Operations/PatchResultBase.ts: -------------------------------------------------------------------------------- 1 | import { PatchStatus } from "./PatchStatus.js"; 2 | 3 | 4 | export class PatchResultBase { 5 | public status: PatchStatus; 6 | public modifiedDocument: object; 7 | public lastModified: Date; 8 | public changeVector: string; 9 | public collection: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/Documents/Operations/PatchStatus.ts: -------------------------------------------------------------------------------- 1 | export type PatchStatus = 2 | 3 | /** 4 | * The document does not exists, operation was a no-op 5 | */ 6 | "DocumentDoesNotExist" 7 | 8 | /** 9 | * The document did not exist, but patchIfMissing was specified and new document was created 10 | */ 11 | | "Created" 12 | 13 | /** 14 | * The document was properly patched 15 | */ 16 | | "Patched" 17 | 18 | /** 19 | * The document was not patched, because skipPatchIfChangeVectorMismatch was set and the etag did not match 20 | */ 21 | | "Skipped" 22 | 23 | /** 24 | * Neither document body not metadata was changed during patch operation 25 | */ 26 | | "NotModified"; 27 | -------------------------------------------------------------------------------- /src/Documents/Operations/QueueSink/AddQueueSinkOperationResult.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface AddQueueSinkOperationResult { 4 | raftCommandIndex: number; 5 | taskId: number; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/QueueSink/QueueSinkConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { QueueBrokerType } from "../Etl/ConnectionString.js"; 2 | import { QueueSinkScript } from "./QueueSinkScript.js"; 3 | 4 | export interface QueueSinkConfiguration { 5 | brokerType: QueueBrokerType; 6 | taskId?: number; 7 | disabled?: boolean; 8 | name: string; 9 | mentorName?: string; 10 | pinToMentorNode?: boolean; 11 | connectionStringName: string; 12 | scripts: QueueSinkScript[]; 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Operations/QueueSink/QueueSinkProcessState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface QueueSinkProcessState { 3 | nodeTag: string; 4 | configurationName: string; 5 | scriptName: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Operations/QueueSink/QueueSinkScript.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface QueueSinkScript { 3 | name?: string; 4 | queues: string[]; 5 | script: string; 6 | disabled?: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/QueueSink/UpdateQueueSinkOperationResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface UpdateQueueSinkOperationResult { 3 | raftCommandIndex: number; 4 | taskId: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Operations/Refresh/ConfigureRefreshOperationResult.ts: -------------------------------------------------------------------------------- 1 | export interface ConfigureRefreshOperationResult { 2 | raftCommandIndex: number; 3 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Refresh/RefreshConfiguration.ts: -------------------------------------------------------------------------------- 1 | export interface RefreshConfiguration { 2 | disabled: boolean; 3 | refreshFrequencyInSec: number; 4 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/DetailedReplicationHubAccess.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface DetailedReplicationHubAccess { 3 | name: string; 4 | thumbprint: string; 5 | certificate: string; 6 | notBefore: Date; 7 | notAfter: Date; 8 | subject: string; 9 | issuer: string; 10 | 11 | allowedHubToSinkPaths?: string[]; 12 | allowedSinkToHubPaths?: string[]; 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/IExternalReplication.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IExternalReplication { 3 | disabled?: boolean; 4 | taskId?: number; 5 | name?: string; 6 | mentorNode?: string; 7 | delayReplicationFor?: string; 8 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/PreventDeletionsMode.ts: -------------------------------------------------------------------------------- 1 | 2 | export type PreventDeletionsMode = 3 | "None" 4 | | "PreventSinkToHubDeletions"; -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/PullReplicationAsSink.ts: -------------------------------------------------------------------------------- 1 | import { ExternalReplicationBase } from "../../Replication/ExternalReplicationBase.js"; 2 | import { PullReplicationMode } from "./PullReplicationMode.js"; 3 | 4 | export interface PullReplicationAsSink extends ExternalReplicationBase { 5 | mode: PullReplicationMode; 6 | allowedHubToSinkPaths?: string[]; 7 | allowedSinkToHubPaths?: string[]; 8 | certificateWithPrivateKey?: string; 9 | certificatePassword?: string; 10 | accessName?: string; 11 | hubName?: string; 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/PullReplicationDefinition.ts: -------------------------------------------------------------------------------- 1 | import { PreventDeletionsMode } from "./PreventDeletionsMode.js"; 2 | import { PullReplicationMode } from "./PullReplicationMode.js"; 3 | 4 | export interface PullReplicationDefinition { 5 | delayReplicationFor?: string; 6 | disabled?: boolean; 7 | mentorNode?: string; 8 | 9 | mode?: PullReplicationMode; 10 | name: string; 11 | taskId?: number; 12 | withFiltering?: boolean; 13 | preventDeletionsMode?: PreventDeletionsMode; 14 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/PullReplicationDefinitionAndCurrentConnections.ts: -------------------------------------------------------------------------------- 1 | import { PullReplicationDefinition } from "./PullReplicationDefinition.js"; 2 | import { OngoingTaskPullReplicationAsHub } from "../OngoingTasks/OngoingTaskPullReplicationAsHub.js"; 3 | 4 | export interface PullReplicationDefinitionAndCurrentConnections { 5 | definition: PullReplicationDefinition; 6 | ongoingTasks: OngoingTaskPullReplicationAsHub[]; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/PullReplicationMode.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export type PullReplicationMode = 4 | "None" 5 | | "HubToSink" 6 | | "SinkToHub" 7 | | "HubToSink,SinkToHub"; -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/ReplicationHubAccess.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ReplicationHubAccess { 3 | name: string; 4 | certificateBase64: string; 5 | 6 | allowedHubToSinkPaths?: string[]; 7 | allowedSinkToHubPaths?: string[]; 8 | } 9 | -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/ReplicationHubAccessResponse.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ReplicationHubAccessResponse { 3 | raftCommandIndex: number; 4 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Replication/ReplicationHubAccessResult.ts: -------------------------------------------------------------------------------- 1 | import { DetailedReplicationHubAccess } from "./DetailedReplicationHubAccess.js"; 2 | 3 | export interface ReplicationHubAccessResult { 4 | results: DetailedReplicationHubAccess[]; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/Revisions/RevisionsResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export class RevisionsResult { 3 | public results: T[]; 4 | public totalResults: number; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/RevisionsCollectionConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { SetupDocumentBase } from "../SetupDocumentBase.js"; 2 | import { ObjectUtil } from "../../Utility/ObjectUtil.js"; 3 | 4 | export class RevisionsCollectionConfiguration extends SetupDocumentBase { 5 | 6 | public minimumRevisionsToKeep?: number; 7 | public minimumRevisionAgeToKeep?: string; 8 | public disabled: boolean; 9 | public purgeOnDelete?: boolean; 10 | public maximumRevisionsToDeleteUponDocumentUpdate?: number; 11 | 12 | public toRemoteFieldNames() { 13 | return ObjectUtil.transformObjectKeys(this, { defaultTransform: ObjectUtil.pascal }); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Documents/Operations/RevisionsConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { SetupDocumentBase } from "../SetupDocumentBase.js"; 2 | import { RevisionsCollectionConfiguration } from "./RevisionsCollectionConfiguration.js"; 3 | import { ObjectUtil } from "../../Utility/ObjectUtil.js"; 4 | 5 | export class RevisionsConfiguration extends SetupDocumentBase { 6 | public defaultConfig: RevisionsCollectionConfiguration; 7 | public collections: Map; 8 | 9 | public toRemoteFieldNames() { 10 | return { 11 | Default: this.defaultConfig ? this.defaultConfig.toRemoteFieldNames() : undefined, 12 | Collections: this.collections 13 | ? ObjectUtil.mapToLiteral(this.collections, (key, value) => value.toRemoteFieldNames()) 14 | : undefined 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Documents/Operations/SessionOperationExecutor.ts: -------------------------------------------------------------------------------- 1 | import { OperationExecutor } from "./OperationExecutor.js"; 2 | import { InMemoryDocumentSessionOperations } from "../Session/InMemoryDocumentSessionOperations.js"; 3 | import { throwError } from "../../Exceptions/index.js"; 4 | 5 | /** 6 | * For internal session use only 7 | */ 8 | export class SessionOperationExecutor extends OperationExecutor { 9 | private readonly _session: InMemoryDocumentSessionOperations; 10 | 11 | /** 12 | * This constructor should not be used 13 | */ 14 | public constructor(session: InMemoryDocumentSessionOperations) { 15 | super(session.documentStore, session.databaseName); 16 | this._session = session; 17 | } 18 | 19 | public forDatabase(databaseName: string): never { 20 | return throwError("InvalidOperationException", "The method is not supported."); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/AbstractTimeSeriesRange.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface AbstractTimeSeriesRange { 4 | name: string; 5 | } -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/AggregationType.ts: -------------------------------------------------------------------------------- 1 | export type AggregationType = 2 | "First" 3 | | "Last" 4 | | "Min" 5 | | "Max" 6 | | "Sum" 7 | | "Count" 8 | | "Average" 9 | | "Percentile" 10 | | "Slope" 11 | | "StandardDeviation" 12 | ; 13 | 14 | -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/ConfigureRawTimeSeriesPolicyOperation.ts: -------------------------------------------------------------------------------- 1 | import { RawTimeSeriesPolicy } from "./RawTimeSeriesPolicy.js"; 2 | import { ConfigureTimeSeriesPolicyOperation } from "./ConfigureTimeSeriesPolicyOperation.js"; 3 | 4 | export class ConfigureRawTimeSeriesPolicyOperation extends ConfigureTimeSeriesPolicyOperation { 5 | public constructor(collection: string, config: RawTimeSeriesPolicy) { 6 | super(collection, config); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/ConfigureTimeSeriesOperationResult.ts: -------------------------------------------------------------------------------- 1 | export interface ConfigureTimeSeriesOperationResult { 2 | raftCommandIndex: number; 3 | } -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/RawTimeSeriesTypes.ts: -------------------------------------------------------------------------------- 1 | import { TimeValueUnit } from "../../../Primitives/TimeValueUnit.js"; 2 | 3 | export interface TimeSeriesPolicyRaw { 4 | Name: string; 5 | RetentionTime: TimeValueRaw; 6 | AggregationTime: TimeValueRaw; 7 | } 8 | 9 | export interface TimeSeriesCollectionConfigurationRaw { 10 | Disabled: boolean; 11 | Policies: TimeSeriesPolicyRaw[]; 12 | RawPolicy: TimeSeriesPolicyRaw; 13 | } 14 | 15 | export interface TimeValueRaw { 16 | Value: number; 17 | Unit: TimeValueUnit; 18 | } 19 | 20 | export const TIME_SERIES_ROLLUP_SEPARATOR: string = "@"; -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/TimeSeriesCountRange.ts: -------------------------------------------------------------------------------- 1 | import { AbstractTimeSeriesRange } from "./AbstractTimeSeriesRange.js"; 2 | import { TimeSeriesRangeType } from "./TimeSeriesRangeType.js"; 3 | 4 | export interface TimeSeriesCountRange extends AbstractTimeSeriesRange { 5 | count: number; 6 | type: TimeSeriesRangeType; 7 | } -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/TimeSeriesDetails.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesRangeResult } from "./TimeSeriesRangeResult.js"; 2 | 3 | export class TimeSeriesDetails { 4 | public id: string; 5 | public values: Map; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/TimeSeriesItemDetail.ts: -------------------------------------------------------------------------------- 1 | export interface TimeSeriesItemDetail { 2 | name: string; 3 | numberOfEntries: number; 4 | startDate: Date; 5 | endDate: Date; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/TimeSeriesRange.ts: -------------------------------------------------------------------------------- 1 | import { AbstractTimeSeriesRange } from "./AbstractTimeSeriesRange.js"; 2 | 3 | export interface TimeSeriesRange extends AbstractTimeSeriesRange { 4 | from: Date; 5 | to: Date; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/TimeSeriesRangeResult.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesEntry } from "../../Session/TimeSeries/TimeSeriesEntry.js"; 2 | 3 | export class TimeSeriesRangeResult { 4 | public from: Date; 5 | public to: Date; 6 | public entries: TimeSeriesEntry[]; 7 | public totalResults: number; 8 | public includes: any; 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/TimeSeriesRangeType.ts: -------------------------------------------------------------------------------- 1 | 2 | export type TimeSeriesRangeType = "None" | "Last"; -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/TimeSeriesStatistics.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesItemDetail } from "./TimeSeriesItemDetail.js"; 2 | 3 | export interface TimeSeriesStatistics { 4 | documentId: string; 5 | timeSeries: TimeSeriesItemDetail[]; 6 | } -------------------------------------------------------------------------------- /src/Documents/Operations/TimeSeries/TimeSeriesTimeRange.ts: -------------------------------------------------------------------------------- 1 | import { AbstractTimeSeriesRange } from "./AbstractTimeSeriesRange.js"; 2 | import { TimeValue } from "../../../Primitives/TimeValue.js"; 3 | import { TimeSeriesRangeType } from "./TimeSeriesRangeType.js"; 4 | 5 | export interface TimeSeriesTimeRange extends AbstractTimeSeriesRange { 6 | time: TimeValue; 7 | type: TimeSeriesRangeType; 8 | } -------------------------------------------------------------------------------- /src/Documents/Queries/Explanation/ExplanationOptions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Additional configuration to explanation query. 3 | */ 4 | export interface ExplanationOptions { 5 | /** 6 | * Scope explanation to specific group by key. 7 | */ 8 | groupKey: string; 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Queries/Explanation/Explanations.ts: -------------------------------------------------------------------------------- 1 | import { QueryResult } from "../QueryResult.js"; 2 | 3 | export class Explanations { 4 | private _explanations: { [key: string]: string[] }; 5 | 6 | public get explanations() { 7 | return this._explanations; 8 | } 9 | 10 | public set explanations(value) { 11 | this._explanations = value; 12 | } 13 | 14 | public update(queryResult: QueryResult) { 15 | this._explanations = queryResult.explanations; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/Facet.ts: -------------------------------------------------------------------------------- 1 | import { FacetBase } from "./FacetBase.js"; 2 | import { FacetToken } from "../../Session/Tokens/FacetToken.js"; 3 | import { FacetOptions } from "./index.js"; 4 | 5 | export class Facet extends FacetBase { 6 | 7 | public fieldName: string; 8 | public options: FacetOptions; 9 | 10 | public toFacetToken(addQueryParameter: (o: any) => string): FacetToken { 11 | return FacetToken.create(this, addQueryParameter); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/FacetAggregationField.ts: -------------------------------------------------------------------------------- 1 | 2 | export class FacetAggregationField { 3 | public name: string; 4 | public displayName: string; 5 | } -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/FacetBase.ts: -------------------------------------------------------------------------------- 1 | import { FacetAggregation } from "./index.js"; 2 | import { FacetToken } from "../../Session/Tokens/FacetToken.js"; 3 | import { FacetAggregationField } from "./FacetAggregationField.js"; 4 | 5 | export abstract class FacetBase { 6 | 7 | public displayFieldName: string; 8 | 9 | public aggregations: Map> = new Map(); 10 | 11 | public abstract toFacetToken(addQueryParameter: (o: any) => string): FacetToken; 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/FacetSetup.ts: -------------------------------------------------------------------------------- 1 | import { Facet } from "./Facet.js"; 2 | import { RangeFacet } from "./RangeFacet.js"; 3 | import { SetupDocumentBase } from "../../SetupDocumentBase.js"; 4 | import { ObjectUtil } from "../../../Utility/ObjectUtil.js"; 5 | 6 | export class FacetSetup extends SetupDocumentBase { 7 | public id: string; 8 | public facets: Facet[] = []; 9 | public rangeFacets: RangeFacet[] = []; 10 | 11 | public toRemoteFieldNames() { 12 | return ObjectUtil.transformObjectKeys(this, { 13 | defaultTransform: ObjectUtil.pascal 14 | }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/IAggregationDocumentQuery.ts: -------------------------------------------------------------------------------- 1 | import { FacetResultObject } from "./AggregationQueryBase.js"; 2 | import { FacetBase } from "./FacetBase.js"; 3 | import { IFacetBuilder } from "./IFacetBuilder.js"; 4 | import { Lazy } from "../../Lazy.js"; 5 | 6 | export interface IAggregationDocumentQuery { 7 | andAggregateBy(builder: (facetBuilder: IFacetBuilder) => void): IAggregationDocumentQuery; 8 | 9 | andAggregateBy(facet: FacetBase): IAggregationDocumentQuery; 10 | 11 | execute(): Promise; 12 | 13 | executeLazy(): Lazy; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/IFacetBuilder.ts: -------------------------------------------------------------------------------- 1 | import { RangeBuilder } from "./RangeBuilder.js"; 2 | import { IFacetOperations } from "./IFacetOperations.js"; 3 | import { Field } from "../../../Types/index.js"; 4 | 5 | export interface IFacetBuilder { 6 | byRanges(range: RangeBuilder, ...ranges: RangeBuilder[]): IFacetOperations; 7 | 8 | byField(fieldName: Field): IFacetOperations; 9 | 10 | allResults(): IFacetOperations; 11 | 12 | // TBD IFacetOperations ByField(Expression> path); 13 | // TBD IFacetOperations ByRanges(Expression> path, params Expression>[] paths); 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/IFacetOperations.ts: -------------------------------------------------------------------------------- 1 | import { FacetOptions } from "./index.js"; 2 | import { IFacetOperationsBase } from "./IFacetOperationsBase.js"; 3 | 4 | export interface IFacetOperations extends IFacetOperationsBase> { 5 | withOptions(options: FacetOptions): IFacetOperations; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/IFacetOperationsBase.ts: -------------------------------------------------------------------------------- 1 | import { Field } from "../../../Types/index.js"; 2 | 3 | 4 | export interface IFacetOperationsBase { 5 | withDisplayName(displayName: string): TSelf; 6 | 7 | sumOn(path: Field): TSelf; 8 | sumOn(path: Field, displayName: string): TSelf; 9 | 10 | minOn(path: Field): TSelf; 11 | minOn(path: Field, displayName: string): TSelf; 12 | 13 | maxOn(path: Field): TSelf; 14 | maxOn(path: Field, displayName: string): TSelf; 15 | 16 | averageOn(path: Field): TSelf; 17 | averageOn(path: Field, displayName: string): TSelf; 18 | } -------------------------------------------------------------------------------- /src/Documents/Queries/Facets/RangeFacet.ts: -------------------------------------------------------------------------------- 1 | import { FacetBase } from "./FacetBase.js"; 2 | import { FacetToken } from "../../Session/Tokens/FacetToken.js"; 3 | 4 | export class RangeFacet extends FacetBase { 5 | 6 | private readonly _parent: FacetBase; 7 | 8 | public ranges: string[] = []; 9 | 10 | public constructor(parent?: FacetBase) { 11 | super(); 12 | this._parent = parent; 13 | } 14 | 15 | public toFacetToken(addQueryParameter: (o: any) => string): FacetToken { 16 | if (this._parent) { 17 | return this._parent.toFacetToken(addQueryParameter); 18 | } 19 | 20 | return FacetToken.create(this, addQueryParameter); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Documents/Queries/GroupBy.ts: -------------------------------------------------------------------------------- 1 | import { GroupByMethod } from "./GroupByMethod.js"; 2 | 3 | export class GroupBy { 4 | 5 | private _field: string; 6 | private _method: GroupByMethod; 7 | 8 | private constructor() { 9 | // empty 10 | } 11 | 12 | public get field(): string { 13 | return this._field; 14 | } 15 | 16 | public get method(): GroupByMethod { 17 | return this._method; 18 | } 19 | 20 | public static field(fieldName: string): GroupBy { 21 | const groupBy = new GroupBy(); 22 | groupBy._field = fieldName; 23 | groupBy._method = "None"; 24 | 25 | return groupBy; 26 | } 27 | 28 | public static array(fieldName: string) { 29 | const groupBy = new GroupBy(); 30 | groupBy._field = fieldName; 31 | groupBy._method = "Array"; 32 | return groupBy; 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Documents/Queries/GroupByMethod.ts: -------------------------------------------------------------------------------- 1 | export type GroupByMethod = "None" | "Array"; 2 | -------------------------------------------------------------------------------- /src/Documents/Queries/Highlighting/HighlightingOptions.ts: -------------------------------------------------------------------------------- 1 | export interface HighlightingOptions { 2 | groupKey?: string; 3 | preTags?: string[]; 4 | postTags?: string[]; 5 | } 6 | 7 | export function extractHighlightingOptionsFromParameters(hightlightingParameters: object) { 8 | return Object.keys(hightlightingParameters) 9 | .reduce((result, key) => { 10 | if (key === "groupKey" as keyof HighlightingOptions 11 | || key === "preTags" as keyof HighlightingOptions 12 | || key === "postTags" as keyof HighlightingOptions) { 13 | result[key] = hightlightingParameters[key]; 14 | } 15 | 16 | return result; 17 | }, {}); 18 | } 19 | -------------------------------------------------------------------------------- /src/Documents/Queries/Highlighting/HighlightingParameters.ts: -------------------------------------------------------------------------------- 1 | import { HighlightingOptions } from "./HighlightingOptions.js"; 2 | 3 | export interface HighlightingParameters extends HighlightingOptions { 4 | fieldName: string; 5 | fragmentLength: number; 6 | fragmentCount: number; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Queries/Highlighting/QueryHighlightings.ts: -------------------------------------------------------------------------------- 1 | import { Highlightings } from "./Hightlightings.js"; 2 | import { QueryResult } from "../QueryResult.js"; 3 | 4 | export class QueryHighlightings { 5 | 6 | private readonly _highlightings: Highlightings[] = []; 7 | 8 | public add(fieldName: string): Highlightings { 9 | const fieldHighlightings = new Highlightings(fieldName); 10 | this._highlightings.push(fieldHighlightings); 11 | return fieldHighlightings; 12 | } 13 | public update(queryResult: QueryResult): void { 14 | for (const fieldHighlightings of this._highlightings) { 15 | fieldHighlightings.update(queryResult.highlightings); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Documents/Queries/IIndexQuery.ts: -------------------------------------------------------------------------------- 1 | export interface IIndexQuery { 2 | waitForNonStaleResultsTimeout: number; 3 | } 4 | -------------------------------------------------------------------------------- /src/Documents/Queries/IndexQueryBase.ts: -------------------------------------------------------------------------------- 1 | import { IIndexQuery } from "./IIndexQuery.js"; 2 | import { ProjectionBehavior } from "./ProjectionBehavior.js"; 3 | 4 | export class IndexQueryBase implements IIndexQuery { 5 | 6 | public query: string; 7 | public queryParameters: T; 8 | public projectionBehavior: ProjectionBehavior; 9 | public waitForNonStaleResults: boolean; 10 | public waitForNonStaleResultsTimeout: number; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Queries/IndexQueryWithParameters.ts: -------------------------------------------------------------------------------- 1 | import { IndexQueryBase } from "./IndexQueryBase.js"; 2 | 3 | export abstract class IndexQueryWithParameters extends IndexQueryBase { 4 | 5 | /** 6 | * Allow to skip duplicate checking during queries 7 | */ 8 | public skipDuplicateChecking: boolean; 9 | 10 | public skipStatistics: boolean; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/IMoreLikeThisBuilderBase.ts: -------------------------------------------------------------------------------- 1 | import { IMoreLikeThisOperations } from "./IMoreLikeThisOperations.js"; 2 | 3 | export interface IMoreLikeThisBuilderBase { 4 | usingAnyDocument(): IMoreLikeThisOperations; 5 | 6 | usingDocument(documentJson: string): IMoreLikeThisOperations; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/IMoreLikeThisBuilderForDocumentQuery.ts: -------------------------------------------------------------------------------- 1 | import { IMoreLikeThisBuilderBase } from "./IMoreLikeThisBuilderBase.js"; 2 | import { IMoreLikeThisOperations } from "./IMoreLikeThisOperations.js"; 3 | import { IFilterDocumentQueryBase } from "../../Session/IFilterDocumentQueryBase.js"; 4 | import { IDocumentQuery } from "../../Session/IDocumentQuery.js"; 5 | 6 | export interface IMoreLikeThisBuilderForDocumentQuery extends IMoreLikeThisBuilderBase { 7 | usingDocument(documentJson: string): IMoreLikeThisOperations; 8 | 9 | usingDocument(builder: (query: IFilterDocumentQueryBase>) => IDocumentQuery): 10 | IMoreLikeThisOperations; 11 | 12 | usingAnyDocument(): IMoreLikeThisOperations; 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/IMoreLikeThisOperations.ts: -------------------------------------------------------------------------------- 1 | import { MoreLikeThisOptions } from "./MoreLikeThisOptions.js"; 2 | 3 | export interface IMoreLikeThisOperations { 4 | withOptions(options: MoreLikeThisOptions): IMoreLikeThisOperations; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/MoreLikeThisBase.ts: -------------------------------------------------------------------------------- 1 | import { MoreLikeThisOptions } from "./MoreLikeThisOptions.js"; 2 | 3 | export abstract class MoreLikeThisBase { 4 | public options: MoreLikeThisOptions; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/MoreLikeThisOptions.ts: -------------------------------------------------------------------------------- 1 | export interface MoreLikeThisOptions { 2 | minimumTermFrequency?: number; 3 | maximumQueryTerms?: number; 4 | maximumNumberOfTokensParsed?: number; 5 | minimumWordLength?: number; 6 | maximumWordLength?: number; 7 | minimumDocumentFrequency?: number; 8 | maximumDocumentFrequency?: number; 9 | maximumDocumentFrequencyPercentage?: number; 10 | boost?: boolean; 11 | boostFactor?: number; 12 | stopWordsDocumentId?: string; 13 | fields?: string[]; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/MoreLikeThisStopWords.ts: -------------------------------------------------------------------------------- 1 | import { SetupDocumentBase } from "../../SetupDocumentBase.js"; 2 | import { ObjectUtil } from "../../../Utility/ObjectUtil.js"; 3 | 4 | export class MoreLikeThisStopWords extends SetupDocumentBase { 5 | public id: string; 6 | public stopWords: string[]; 7 | 8 | public toRemoteFieldNames() { 9 | return ObjectUtil.transformObjectKeys(this, { defaultTransform: ObjectUtil.pascal }); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/MoreLikeThisUsingAnyDocument.ts: -------------------------------------------------------------------------------- 1 | import { MoreLikeThisBase } from "./MoreLikeThisBase.js"; 2 | 3 | export class MoreLikeThisUsingAnyDocument extends MoreLikeThisBase { 4 | // empty 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/MoreLikeThisUsingDocument.ts: -------------------------------------------------------------------------------- 1 | import { MoreLikeThisBase } from "./MoreLikeThisBase.js"; 2 | 3 | export class MoreLikeThisUsingDocument extends MoreLikeThisBase { 4 | public documentJson: string; 5 | 6 | constructor(documentJson: string) { 7 | super(); 8 | this.documentJson = documentJson; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Documents/Queries/MoreLikeThis/MoreLikeThisUsingDocumentForDocumentQuery.ts: -------------------------------------------------------------------------------- 1 | import { MoreLikeThisBase } from "./MoreLikeThisBase.js"; 2 | import { IFilterDocumentQueryBase } from "../../Session/IFilterDocumentQueryBase.js"; 3 | import { IDocumentQuery } from "../../Session/IDocumentQuery.js"; 4 | 5 | export class MoreLikeThisUsingDocumentForDocumentQuery extends MoreLikeThisBase { 6 | public forDocumentQuery: (query: IFilterDocumentQueryBase>) => IDocumentQuery; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Queries/ProjectionBehavior.ts: -------------------------------------------------------------------------------- 1 | 2 | export type ProjectionBehavior = 3 | /** 4 | * Try to extract value from index field (if field value is stored in index), 5 | * on a failure (or when field value is not stored in index) extract value from a document 6 | */ 7 | "Default" 8 | /** 9 | * Try to extract value from index field (if field value is stored in index), on a failure skip field 10 | */ 11 | | "FromIndex" 12 | /** 13 | * Extract value from index field or throw 14 | */ 15 | | "FromIndexOrThrow" 16 | /** 17 | * Try to extract value from document field, on a failure skip field 18 | */ 19 | | "FromDocument" 20 | /** 21 | * Extract value from document field or throw 22 | */ 23 | | "FromDocumentOrThrow" 24 | ; -------------------------------------------------------------------------------- /src/Documents/Queries/QueryOperationOptions.ts: -------------------------------------------------------------------------------- 1 | export interface QueryOperationOptions { 2 | maxOpsPerSecond: number; 3 | allowStale: boolean; 4 | /** 5 | * Ignore the maximum number of statements a script can execute as defined in the server configuration. 6 | */ 7 | ignoreMaxStepsForScript?: boolean; 8 | staleTimeout: number; 9 | retrieveDetails: boolean; 10 | } 11 | -------------------------------------------------------------------------------- /src/Documents/Queries/QueryOperator.ts: -------------------------------------------------------------------------------- 1 | export type QueryOperator = "AND" | "OR"; 2 | -------------------------------------------------------------------------------- /src/Documents/Queries/QueryResultBase.ts: -------------------------------------------------------------------------------- 1 | import { QueryTimings } from "./Timings/QueryTimings.js"; 2 | 3 | export abstract class QueryResultBase { 4 | 5 | public results: TResult; 6 | 7 | public includes: TInclude; 8 | 9 | public includedPaths: string[]; 10 | 11 | public isStale: boolean; 12 | 13 | public indexTimestamp: Date; 14 | 15 | public indexName: string; 16 | 17 | public resultEtag: number; 18 | 19 | public lastQueryTime: Date; 20 | 21 | public counterIncludes: object; 22 | 23 | public revisionIncludes: any[]; 24 | 25 | public includedCounterNames: { [key: string]: string[] }; 26 | 27 | public timeSeriesIncludes: any; 28 | 29 | public compareExchangeValueIncludes: any; 30 | 31 | public nodeTag: string; 32 | 33 | public timings: QueryTimings; 34 | } 35 | -------------------------------------------------------------------------------- /src/Documents/Queries/SearchOperator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Search operator between terms in a search clause 3 | */ 4 | export type SearchOperator = "AND" | "OR"; 5 | -------------------------------------------------------------------------------- /src/Documents/Queries/Sorting/SorterDefinition.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface SorterDefinition { 4 | name: string; 5 | code: string; 6 | } -------------------------------------------------------------------------------- /src/Documents/Queries/Spatial/DynamicSpatialField.ts: -------------------------------------------------------------------------------- 1 | export abstract class DynamicSpatialField { 2 | 3 | public roundFactor: number; 4 | 5 | public abstract toField(ensureValidFieldName: (fieldName: string, isNestedPath: boolean) => string): string; 6 | 7 | public roundTo(factor: number) { 8 | this.roundFactor = factor; 9 | return this; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Queries/Spatial/PointField.ts: -------------------------------------------------------------------------------- 1 | import { DynamicSpatialField } from "./DynamicSpatialField.js"; 2 | 3 | export class PointField extends DynamicSpatialField { 4 | public latitude: string; 5 | public longitude: string; 6 | 7 | public constructor(latitude: string, longitude: string) { 8 | super(); 9 | 10 | this.latitude = latitude; 11 | this.longitude = longitude; 12 | } 13 | 14 | public toField(ensureValidFieldName: (fieldName: string, isNestedPath: boolean) => string): string { 15 | return "spatial.point(" + 16 | ensureValidFieldName(this.latitude, false) + ", " + ensureValidFieldName(this.longitude, false) + ")"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Documents/Queries/Spatial/WktCriteria.ts: -------------------------------------------------------------------------------- 1 | import { SpatialCriteria } from "./SpatialCriteria.js"; 2 | import { SpatialRelation, SpatialUnits } from "../../Indexes/Spatial.js"; 3 | import { ShapeToken } from "../../Session/Tokens/ShapeToken.js"; 4 | 5 | export class WktCriteria extends SpatialCriteria { 6 | private readonly _shapeWkt: string; 7 | private readonly _radiusUnits: SpatialUnits; 8 | 9 | public constructor( 10 | shapeWkt: string, 11 | relation: SpatialRelation, 12 | radiusUnits: SpatialUnits, 13 | distanceErrorPct: number) { 14 | super(relation, distanceErrorPct); 15 | this._shapeWkt = shapeWkt; 16 | this._radiusUnits = radiusUnits; 17 | } 18 | 19 | protected _getShapeToken(addQueryParameter: (o: any) => string): ShapeToken { 20 | return ShapeToken.wkt(addQueryParameter(this._shapeWkt), this._radiusUnits); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Documents/Queries/Spatial/WktField.ts: -------------------------------------------------------------------------------- 1 | import { DynamicSpatialField } from "./DynamicSpatialField.js"; 2 | 3 | export class WktField extends DynamicSpatialField { 4 | public wkt: string; 5 | 6 | public constructor(wkt: string) { 7 | super(); 8 | this.wkt = wkt; 9 | } 10 | 11 | public toField(ensureValidFieldName: (fieldName: string, isNestedPath: boolean) => string): string { 12 | return "spatial.wkt(" + ensureValidFieldName(this.wkt, false) + ")"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/ISuggestionBuilder.ts: -------------------------------------------------------------------------------- 1 | import { ISuggestionOperations } from "./ISuggestionOperations.js"; 2 | import { Field } from "../../../Types/index.js"; 3 | 4 | export interface ISuggestionBuilder { 5 | 6 | byField(fieldName: Field, term: string): ISuggestionOperations; 7 | 8 | byField(fieldName: Field, terms: string[]): ISuggestionOperations; 9 | 10 | //TBD expr ISuggestionOperations ByField(Expression> path, string term); 11 | //TBD expr ISuggestionOperations ByField(Expression> path, string[] terms); 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/ISuggestionDocumentQuery.ts: -------------------------------------------------------------------------------- 1 | import { SuggestionsResponseObject } from "../../../Types/index.js"; 2 | import { Lazy } from "../../Lazy.js"; 3 | import { SuggestionBase } from "./SuggestionBase.js"; 4 | import { ISuggestionBuilder } from "./ISuggestionBuilder.js"; 5 | 6 | export interface ISuggestionDocumentQuery { 7 | execute(): Promise; 8 | 9 | executeLazy(): Lazy; 10 | 11 | andSuggestUsing(suggestion: SuggestionBase): ISuggestionDocumentQuery; 12 | 13 | andSuggestUsing(builder: (b: ISuggestionBuilder) => void): ISuggestionDocumentQuery; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/ISuggestionOperations.ts: -------------------------------------------------------------------------------- 1 | import { SuggestionOptions } from "./SuggestionOptions.js"; 2 | 3 | export interface ISuggestionOperations { 4 | withDisplayName(displayName: string): ISuggestionOperations; 5 | withOptions(options: SuggestionOptions): ISuggestionOperations; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/StringDistanceTypes.ts: -------------------------------------------------------------------------------- 1 | export type StringDistanceTypes = "None" | "Default" | "Levenshtein" | "JaroWinkler" | "NGram"; 2 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/SuggestionBase.ts: -------------------------------------------------------------------------------- 1 | import { SuggestionOptions } from "./SuggestionOptions.js"; 2 | 3 | export abstract class SuggestionBase { 4 | public field: string; 5 | public displayField: string; 6 | public options: SuggestionOptions; 7 | 8 | protected constructor(field: string) { 9 | this.field = field; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/SuggestionOptions.ts: -------------------------------------------------------------------------------- 1 | import { StringDistanceTypes } from "./StringDistanceTypes.js"; 2 | import { SuggestionSortMode } from "./SuggestionSortMode.js"; 3 | 4 | export interface SuggestionOptions { 5 | pageSize: number; 6 | distance: StringDistanceTypes; 7 | accuracy: number; 8 | sortMode: SuggestionSortMode; 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/SuggestionResult.ts: -------------------------------------------------------------------------------- 1 | export interface SuggestionResult { 2 | name: string; 3 | suggestions: string[]; 4 | } 5 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/SuggestionSortMode.ts: -------------------------------------------------------------------------------- 1 | export type SuggestionSortMode = "None" | "Popularity"; 2 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/SuggestionWithTerm.ts: -------------------------------------------------------------------------------- 1 | import { SuggestionBase } from "./SuggestionBase.js"; 2 | 3 | export class SuggestionWithTerm extends SuggestionBase { 4 | public term: string; 5 | 6 | public constructor(field: string) { 7 | super(field); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Queries/Suggestions/SuggestionWithTerms.ts: -------------------------------------------------------------------------------- 1 | import { SuggestionBase } from "./SuggestionBase.js"; 2 | 3 | export class SuggestionWithTerms extends SuggestionBase { 4 | public terms: string[]; 5 | 6 | public constructor(field: string) { 7 | super(field); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Queries/TimeSeries/ITimeSeriesQueryBuilder.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesQueryResult } from "./TimeSeriesQueryResult.js"; 2 | 3 | export interface ITimeSeriesQueryBuilder { 4 | raw(queryText: string): T; 5 | } -------------------------------------------------------------------------------- /src/Documents/Queries/TimeSeries/TimeSeriesAggregationResult.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesQueryResult } from "./TimeSeriesQueryResult.js"; 2 | import { TimeSeriesRangeAggregation } from "./TimeSeriesRangeAggregation.js"; 3 | import { EntityConstructor } from "../../../Types/index.js"; 4 | import { TypedTimeSeriesAggregationResult } from "./TypedTimeSeriesAggregationResult.js"; 5 | 6 | export class TimeSeriesAggregationResult extends TimeSeriesQueryResult { 7 | public results: TimeSeriesRangeAggregation[]; 8 | 9 | public asTypedEntry(clazz: EntityConstructor) { 10 | const result = new TypedTimeSeriesAggregationResult(); 11 | result.count = this.count; 12 | result.results = this.results.map(x => x.asTypedEntry(clazz)); 13 | return result; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Documents/Queries/TimeSeries/TimeSeriesQueryBuilder.ts: -------------------------------------------------------------------------------- 1 | import { ITimeSeriesQueryBuilder } from "./ITimeSeriesQueryBuilder.js"; 2 | import { TimeSeriesQueryResult } from "./TimeSeriesQueryResult.js"; 3 | 4 | export class TimeSeriesQueryBuilder implements ITimeSeriesQueryBuilder { 5 | private _query: string; 6 | 7 | raw(queryText: string): T { 8 | this._query = queryText; 9 | return null; 10 | } 11 | 12 | public get queryText() { 13 | return this._query; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Documents/Queries/TimeSeries/TimeSeriesQueryResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export class TimeSeriesQueryResult { 3 | public count: number; 4 | } 5 | -------------------------------------------------------------------------------- /src/Documents/Queries/TimeSeries/TimeSeriesRawResult.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesQueryResult } from "./TimeSeriesQueryResult.js"; 2 | import { TimeSeriesEntry } from "../../Session/TimeSeries/TimeSeriesEntry.js"; 3 | import { ClassConstructor } from "../../../Types/index.js"; 4 | import { TypedTimeSeriesRawResult } from "./TypedTimeSeriesRawResult.js"; 5 | 6 | export class TimeSeriesRawResult extends TimeSeriesQueryResult { 7 | public results: TimeSeriesEntry[]; 8 | 9 | public asTypedResult(clazz: ClassConstructor) { 10 | const result = new TypedTimeSeriesRawResult(); 11 | result.count = this.count; 12 | result.results = this.results.map(x => x.asTypedEntry(clazz)); 13 | return result; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Documents/Queries/TimeSeries/TypedTimeSeriesAggregationResult.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesQueryResult } from "./TimeSeriesQueryResult.js"; 2 | import { TypedTimeSeriesRangeAggregation } from "./TypedTimeSeriesRangeAggregation.js"; 3 | 4 | export class TypedTimeSeriesAggregationResult extends TimeSeriesQueryResult { 5 | public results: TypedTimeSeriesRangeAggregation[]; 6 | } -------------------------------------------------------------------------------- /src/Documents/Queries/TimeSeries/TypedTimeSeriesRangeAggregation.ts: -------------------------------------------------------------------------------- 1 | 2 | export class TypedTimeSeriesRangeAggregation { 3 | public count: T; 4 | public max: T; 5 | public min: T; 6 | public last: T; 7 | public first: T; 8 | public average: T; 9 | public sum: T; 10 | public to: Date; 11 | public from: Date; 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Queries/TimeSeries/TypedTimeSeriesRawResult.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesQueryResult } from "./TimeSeriesQueryResult.js"; 2 | import { TypedTimeSeriesEntry } from "../../Session/TimeSeries/TypedTimeSeriesEntry.js"; 3 | 4 | export class TypedTimeSeriesRawResult extends TimeSeriesQueryResult { 5 | public results: TypedTimeSeriesEntry[]; 6 | } -------------------------------------------------------------------------------- /src/Documents/Queries/Timings/QueryTimings.ts: -------------------------------------------------------------------------------- 1 | import { QueryResult } from "../QueryResult.js"; 2 | 3 | export class QueryTimings { 4 | public durationInMs: number; 5 | public timings: { [key: string]: QueryTimings }; 6 | public queryPlan: any; 7 | 8 | public update(queryResult: QueryResult): void { 9 | this.durationInMs = 0; 10 | this.timings = null; 11 | if (!queryResult.timings) { 12 | return; 13 | } 14 | 15 | this.durationInMs = queryResult.timings.durationInMs; 16 | this.timings = queryResult.timings.timings; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Documents/Replication/ExternalReplication.ts: -------------------------------------------------------------------------------- 1 | import { ExternalReplicationBase } from "./ExternalReplicationBase.js"; 2 | import { IExternalReplication } from "../Operations/Replication/IExternalReplication.js"; 3 | 4 | export interface ExternalReplication extends ExternalReplicationBase, IExternalReplication { 5 | delayReplicationFor?: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Replication/ExternalReplicationBase.ts: -------------------------------------------------------------------------------- 1 | import { ReplicationNode } from "./ReplicationNode.js"; 2 | 3 | 4 | export interface ExternalReplicationBase extends ReplicationNode { 5 | taskId?: number; 6 | name?: string; 7 | connectionStringName: string; 8 | mentorNode?: string; 9 | } -------------------------------------------------------------------------------- /src/Documents/Replication/ReplicationNode.ts: -------------------------------------------------------------------------------- 1 | export interface ReplicationNode { 2 | url?: string; 3 | database?: string; 4 | disabled?: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Session/CmpXchg.ts: -------------------------------------------------------------------------------- 1 | import { MethodCall } from "./MethodCall.js"; 2 | 3 | export class CmpXchg extends MethodCall { 4 | 5 | public static value(key: string): CmpXchg { 6 | const cmpXchg = new CmpXchg(); 7 | cmpXchg.args = [key]; 8 | 9 | return cmpXchg; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Documents/Session/ConditionalLoadResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ConditionalLoadResult { 3 | entity: T | null; 4 | changeVector: string; 5 | } -------------------------------------------------------------------------------- /src/Documents/Session/CounterInternalTypes.ts: -------------------------------------------------------------------------------- 1 | export type CountersByDocId = Map ]>; 2 | 3 | export interface CounterTracking { 4 | gotAll: boolean; 5 | data: Map; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Session/DocumentResultStream.ts: -------------------------------------------------------------------------------- 1 | import { StreamResult } from "../Commands/StreamResult.js"; 2 | import { StreamQueryStatistics } from "./StreamQueryStatistics.js"; 3 | import { Readable } from "node:stream"; 4 | 5 | export interface DocumentStreamResultEvents { 6 | data: StreamResult; 7 | error: Error; 8 | stats: StreamQueryStatistics; 9 | end: void; 10 | } 11 | 12 | export type DocumentResultStream = Readable; 13 | -------------------------------------------------------------------------------- /src/Documents/Session/DocumentsChanges.ts: -------------------------------------------------------------------------------- 1 | export class DocumentsChanges { 2 | 3 | public fieldOldValue: any; 4 | public fieldNewValue: any; 5 | public change: ChangeType; 6 | public fieldName: string; 7 | public fieldPath: string; 8 | 9 | public get fieldFullName() { 10 | return !this.fieldPath ? this.fieldName : this.fieldPath + "." + this.fieldName; 11 | } 12 | } 13 | 14 | export type ChangeType = 15 | "DocumentDeleted" 16 | | "DocumentAdded" 17 | | "FieldChanged" 18 | | "NewField" 19 | | "RemovedField" 20 | | "ArrayValueChanged" 21 | | "ArrayValueAdded" 22 | | "ArrayValueRemoved"; 23 | -------------------------------------------------------------------------------- /src/Documents/Session/ForceRevisionStrategy.ts: -------------------------------------------------------------------------------- 1 | 2 | export type ForceRevisionStrategy = 3 | /** 4 | * Don't force revision 5 | */ 6 | "None" 7 | /** 8 | * Create a forced revision from the document that is currently in store - BEFORE applying any changes made by the user 9 | * The only exception is: with current implementation the forced revision for *new* document only is 'after', not 'before' 10 | */ 11 | | "Before" -------------------------------------------------------------------------------- /src/Documents/Session/GroupByField.ts: -------------------------------------------------------------------------------- 1 | export class GroupByField { 2 | public fieldName: string; 3 | public projectedName: string; 4 | 5 | public constructor(); 6 | public constructor(fieldName: string); 7 | public constructor(fieldName: string, projectedName: string); 8 | public constructor(fieldName?: string, projectedName?: string) { 9 | this.fieldName = fieldName; 10 | this.projectedName = projectedName; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Documents/Session/IAbstractDocumentQueryImpl.ts: -------------------------------------------------------------------------------- 1 | import { FieldsToFetchToken } from "./Tokens/FieldsToFetchToken.js"; 2 | import { QueryOperation } from "./Operations/QueryOperation.js"; 3 | 4 | /** 5 | * This is used as an abstraction for the implementation 6 | * of a query when passing to other parts of the 7 | * query infrastructure. Meant to be internal only, making 8 | * this public to allow mocking / instrumentation. 9 | */ 10 | export interface IAbstractDocumentQueryImpl { 11 | fieldsToFetchToken: FieldsToFetchToken; 12 | isProjectInto: boolean; 13 | initializeQueryOperation(): QueryOperation; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Session/IDocumentQueryBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AdvancedDocumentQueryOptions } from "./QueryOptions.js"; 2 | import { IDocumentQuery } from "./IDocumentQuery.js"; 3 | import { DocumentType } from "../DocumentAbstractions.js"; 4 | import { AbstractCommonApiForIndexes } from "../Indexes/AbstractCommonApiForIndexes.js"; 5 | 6 | /** 7 | * It gives the ability to construct queries with the usage of {@link IDocumentQuery} interface 8 | */ 9 | export interface IDocumentQueryBuilder { 10 | documentQuery(opts: AdvancedDocumentQueryOptions): IDocumentQuery; 11 | documentQuery(documentType: DocumentType): IDocumentQuery; 12 | documentQuery(documentType: DocumentType, index: new () => AbstractCommonApiForIndexes): IDocumentQuery; 13 | } -------------------------------------------------------------------------------- /src/Documents/Session/IEnumerableQuery.ts: -------------------------------------------------------------------------------- 1 | export interface IEnumerableQuery { 2 | 3 | /** 4 | * Materialize query, executes request and returns with results 5 | */ 6 | all(): Promise; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Session/IGroupByDocumentQuery.ts: -------------------------------------------------------------------------------- 1 | import { GroupByField } from "./GroupByField.js"; 2 | import { IDocumentQuery } from "./IDocumentQuery.js"; 3 | import { IFilterFactory } from "../Queries/IFilterFactory.js"; 4 | 5 | export interface IGroupByDocumentQuery { 6 | 7 | selectKey(): IGroupByDocumentQuery; 8 | selectKey(fieldName: string): IGroupByDocumentQuery; 9 | selectKey(fieldName: string, projectedName: string): IGroupByDocumentQuery; 10 | 11 | selectSum(field: GroupByField, ...fields: GroupByField[]): IDocumentQuery; 12 | 13 | selectCount(): IDocumentQuery; 14 | selectCount(projectedName: string): IDocumentQuery; 15 | 16 | filter(builder: (factory: IFilterFactory) => void): IGroupByDocumentQuery; 17 | filter(builder: (factory: IFilterFactory) => void, limit: number): IGroupByDocumentQuery; 18 | } 19 | -------------------------------------------------------------------------------- /src/Documents/Session/ILazyClusterTransactionOperations.ts: -------------------------------------------------------------------------------- 1 | import { Lazy } from "../Lazy.js"; 2 | import { CompareExchangeValue } from "../Operations/CompareExchange/CompareExchangeValue.js"; 3 | import { CompareExchangeResultClass } from "../../Types/index.js"; 4 | 5 | export interface ILazyClusterTransactionOperations { 6 | getCompareExchangeValue(key: string): Lazy | null>; 7 | getCompareExchangeValue(key: string, type: CompareExchangeResultClass): Lazy | null>; 8 | 9 | getCompareExchangeValues( 10 | keys: string[]): Lazy<{ [key: string]: CompareExchangeValue | null }>; 11 | getCompareExchangeValues( 12 | keys: string[], type: CompareExchangeResultClass): Lazy<{ [key: string]: CompareExchangeValue | null }>; 13 | 14 | } -------------------------------------------------------------------------------- /src/Documents/Session/IMetadataDictionary.ts: -------------------------------------------------------------------------------- 1 | import { MetadataObject } from "./MetadataObject.js"; 2 | 3 | export interface IRawMetadataDictionary extends MetadataObject { 4 | [key: string]: any; 5 | } 6 | 7 | export interface IMetadataDictionary extends IRawMetadataDictionary { 8 | isDirty(): boolean; 9 | } 10 | -------------------------------------------------------------------------------- /src/Documents/Session/IPagingDocumentQueryBase.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IPagingDocumentQueryBase> { 3 | /** 4 | * Skips the specified count. 5 | * @param count Items to skip 6 | */ 7 | skip(count: number): TSelf; 8 | 9 | /** 10 | * Takes the specified count. 11 | * @param count Amount of items to take 12 | */ 13 | take(count: number): TSelf; 14 | } -------------------------------------------------------------------------------- /src/Documents/Session/ISessionDocumentDeleteTimeSeriesBase.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ISessionDocumentDeleteTimeSeriesBase { 3 | 4 | /** 5 | * Delete all the values in the time series 6 | */ 7 | delete(): void; 8 | 9 | /** 10 | * Delete all the values in the time series in the range of from .. to. 11 | * @param from range start 12 | * @param to range end 13 | */ 14 | delete(from: Date, to: Date): void; 15 | 16 | /** 17 | * Delete the value in the time series in the specified time stamp 18 | * @param at date to remove 19 | */ 20 | deleteAt(at: Date): void; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/Documents/Session/ISessionDocumentRollupTypedAppendTimeSeriesBase.ts: -------------------------------------------------------------------------------- 1 | import { TypedTimeSeriesRollupEntry } from "./TimeSeries/TypedTimeSeriesRollupEntry.js"; 2 | 3 | export interface ISessionDocumentRollupTypedAppendTimeSeriesBase { 4 | append(entry: TypedTimeSeriesRollupEntry): void; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Session/ISessionDocumentRollupTypedTimeSeries.ts: -------------------------------------------------------------------------------- 1 | import { ISessionDocumentRollupTypedAppendTimeSeriesBase } from "./ISessionDocumentRollupTypedAppendTimeSeriesBase.js"; 2 | import { ISessionDocumentDeleteTimeSeriesBase } from "./ISessionDocumentDeleteTimeSeriesBase.js"; 3 | import { TypedTimeSeriesRollupEntry } from "./TimeSeries/TypedTimeSeriesRollupEntry.js"; 4 | 5 | export interface ISessionDocumentRollupTypedTimeSeries 6 | extends ISessionDocumentRollupTypedAppendTimeSeriesBase, ISessionDocumentDeleteTimeSeriesBase { 7 | 8 | get(): Promise[]>; 9 | get(from: Date, to: Date): Promise[]>; 10 | get(from: Date, to: Date, start: number): Promise[]>; 11 | get(from: Date, to: Date, start: number, pageSize: number): Promise[]>; 12 | } -------------------------------------------------------------------------------- /src/Documents/Session/ISessionDocumentTypedAppendTimeSeriesBase.ts: -------------------------------------------------------------------------------- 1 | import { TypedTimeSeriesEntry } from "./TimeSeries/TypedTimeSeriesEntry.js"; 2 | 3 | export interface ISessionDocumentTypedAppendTimeSeriesBase { 4 | append(timestamp: Date, entry: T): void; 5 | append(timestamp: Date, entry: T, tag: string): void; 6 | append(entry: TypedTimeSeriesEntry): void; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/IAbstractTimeSeriesIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | import { TimeSeriesRangeType } from "../../Operations/TimeSeries/TimeSeriesRangeType.js"; 2 | import { TimeValue } from "../../../Primitives/TimeValue.js"; 3 | 4 | export interface IAbstractTimeSeriesIncludeBuilder { 5 | 6 | includeTimeSeries(name: string, type: TimeSeriesRangeType, time: TimeValue): TBuilder; 7 | includeTimeSeries(name: string, type: TimeSeriesRangeType, count: number): TBuilder; 8 | 9 | includeTimeSeries(names: string[], type: TimeSeriesRangeType, time: TimeValue): TBuilder; 10 | includeTimeSeries(names: string[], type: TimeSeriesRangeType, count: number): TBuilder; 11 | 12 | includeAllTimeSeries(type: TimeSeriesRangeType, time: TimeValue): TBuilder; 13 | includeAllTimeSeries(type: TimeSeriesRangeType, count: number): TBuilder; 14 | 15 | } -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/ICompareExchangeValueIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ICompareExchangeValueIncludeBuilder { 3 | includeCompareExchangeValue(path: string): TBuilder; 4 | } -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/ICounterIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | export interface ICounterIncludeBuilder { 2 | includeCounter(name: string): TBuilder; 3 | includeCounters(names: string[]): TBuilder; 4 | includeAllCounters(): TBuilder; 5 | } -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/IDocumentIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | export interface IDocumentIncludeBuilder { 2 | includeDocuments(path: string): TBuilder; 3 | } -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/IGenericIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | import { IDocumentIncludeBuilder } from "./IDocumentIncludeBuilder.js"; 2 | import { ICounterIncludeBuilder } from "./ICounterIncludeBuilder.js"; 3 | import { ICompareExchangeValueIncludeBuilder } from "./ICompareExchangeValueIncludeBuilder.js"; 4 | import { IGenericTimeSeriesIncludeBuilder } from "./IGenericTimeSeriesIncludeBuilder.js"; 5 | import { IGenericRevisionIncludeBuilder } from "./IGenericRevisionIncludeBuilder.js"; 6 | 7 | export interface IGenericIncludeBuilder 8 | extends IDocumentIncludeBuilder, 9 | ICounterIncludeBuilder, 10 | IGenericTimeSeriesIncludeBuilder, 11 | ICompareExchangeValueIncludeBuilder, 12 | IGenericRevisionIncludeBuilder { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/IGenericRevisionIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IGenericRevisionIncludeBuilder { 3 | includeRevisions(path: string): TBuilder; 4 | includeRevisions(before: Date): TBuilder; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/IGenericTimeSeriesIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | import { IAbstractTimeSeriesIncludeBuilder } from "./IAbstractTimeSeriesIncludeBuilder.js"; 2 | import { TimeSeriesRangeType } from "../../Operations/TimeSeries/TimeSeriesRangeType.js"; 3 | import { TimeValue } from "../../../Primitives/TimeValue.js"; 4 | 5 | export interface IGenericTimeSeriesIncludeBuilder extends IAbstractTimeSeriesIncludeBuilder { 6 | includeTimeSeries(name: string): TBuilder; 7 | includeTimeSeries(name: string, from: Date, to: Date): TBuilder; 8 | 9 | includeTimeSeries(name: string, type: TimeSeriesRangeType, time: TimeValue): TBuilder; 10 | includeTimeSeries(name: string, type: TimeSeriesRangeType, count: number): TBuilder; 11 | 12 | includeTimeSeries(names: string[], type: TimeSeriesRangeType, time: TimeValue): TBuilder; 13 | includeTimeSeries(names: string[], type: TimeSeriesRangeType, count: number): TBuilder; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/IIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | import { IGenericIncludeBuilder } from "./IGenericIncludeBuilder.js"; 2 | 3 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 4 | export interface IIncludeBuilder extends IGenericIncludeBuilder { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/ISubscriptionIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | import { IDocumentIncludeBuilder } from "./IDocumentIncludeBuilder.js"; 2 | import { ICounterIncludeBuilder } from "./ICounterIncludeBuilder.js"; 3 | import { ISubscriptionTimeSeriesIncludeBuilder } from "./ISubscriptionTimeSeriesIncludeBuilder.js"; 4 | 5 | export interface ISubscriptionIncludeBuilder extends IDocumentIncludeBuilder, 6 | ICounterIncludeBuilder, ISubscriptionTimeSeriesIncludeBuilder { 7 | } -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/ISubscriptionTimeSeriesIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | import { IAbstractTimeSeriesIncludeBuilder } from "./IAbstractTimeSeriesIncludeBuilder.js"; 2 | 3 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 4 | export interface ISubscriptionTimeSeriesIncludeBuilder extends IAbstractTimeSeriesIncludeBuilder { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/ITimeSeriesIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ITimeSeriesIncludeBuilder { 3 | includeTags(): ITimeSeriesIncludeBuilder; 4 | includeDocument(): ITimeSeriesIncludeBuilder; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Session/Loaders/TimeSeriesIncludeBuilder.ts: -------------------------------------------------------------------------------- 1 | import { IncludeBuilderBase } from "./IncludeBuilderBase.js"; 2 | import { ITimeSeriesIncludeBuilder } from "./ITimeSeriesIncludeBuilder.js"; 3 | 4 | export class TimeSeriesIncludeBuilder extends IncludeBuilderBase implements ITimeSeriesIncludeBuilder { 5 | 6 | public includeTags(): ITimeSeriesIncludeBuilder { 7 | this.includeTimeSeriesTags = true; 8 | return this; 9 | } 10 | 11 | includeDocument(): ITimeSeriesIncludeBuilder { 12 | this.includeTimeSeriesDocument = true; 13 | return this; 14 | } 15 | } -------------------------------------------------------------------------------- /src/Documents/Session/MetadataObject.ts: -------------------------------------------------------------------------------- 1 | import { AttachmentDetails } from "../Attachments/index.js"; 2 | 3 | export interface MetadataObject { 4 | "@attachments"?: AttachmentDetails[]; 5 | "@collection"?: string; 6 | "@id"?: string; 7 | "@last-modified"?: string; 8 | "@flags"?: string; 9 | "@counters"?: string[]; 10 | "@expires"?: string; 11 | "@change-vector"?: string; 12 | "Raven-Node-Type"?: string; 13 | "@timeseries"?: string[]; 14 | "@nested-object-types"?: { [key: string]: string }; 15 | } 16 | -------------------------------------------------------------------------------- /src/Documents/Session/MethodCall.ts: -------------------------------------------------------------------------------- 1 | export abstract class MethodCall { 2 | public args: any[]; 3 | public accessPath: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/Documents/Session/Operations/BatchCommandResult.ts: -------------------------------------------------------------------------------- 1 | export class BatchCommandResult { 2 | public results: any[]; 3 | public transactionIndex: number; 4 | } 5 | -------------------------------------------------------------------------------- /src/Documents/Session/Operations/Lazy/IEagerSessionOperations.ts: -------------------------------------------------------------------------------- 1 | import { ResponseTimeInformation } from "../../ResponseTimeInformation.js"; 2 | 3 | /** 4 | * Allow to perform eager operations on the session 5 | */ 6 | export interface IEagerSessionOperations { 7 | // TBD ResponseTimeInformation ExecuteAllPendingLazyOperations(); 8 | 9 | /** 10 | * Execute all the lazy requests pending within this session 11 | */ 12 | executeAllPendingLazyOperations(): Promise; 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Session/Operations/Lazy/ILazyOperation.ts: -------------------------------------------------------------------------------- 1 | import { GetRequest } from "../../../Commands/MultiGet/GetRequest.js"; 2 | import { GetResponse } from "../../../Commands/MultiGet/GetResponse.js"; 3 | import { QueryResult } from "../../../Queries/QueryResult.js"; 4 | 5 | export interface ILazyOperation { 6 | result: any; 7 | queryResult: QueryResult; 8 | requiresRetry: boolean; 9 | 10 | createRequest(): GetRequest; 11 | 12 | handleResponseAsync(response: GetResponse): Promise; 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Session/Operations/MultiGetOperation.ts: -------------------------------------------------------------------------------- 1 | import { InMemoryDocumentSessionOperations } from "../InMemoryDocumentSessionOperations.js"; 2 | import { GetRequest } from "../../Commands/MultiGet/GetRequest.js"; 3 | import { MultiGetCommand } from "../../Commands/MultiGet/MultiGetCommand.js"; 4 | 5 | export class MultiGetOperation { 6 | private readonly _session: InMemoryDocumentSessionOperations; 7 | 8 | public constructor(session: InMemoryDocumentSessionOperations) { 9 | this._session = session; 10 | } 11 | 12 | public createRequest(requests: GetRequest[]): MultiGetCommand { 13 | return new MultiGetCommand( 14 | this._session.requestExecutor, this._session.conventions, requests, this._session.sessionInfo); 15 | } 16 | 17 | public setResult(result: object): void { 18 | // empty 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Documents/Session/OrderingType.ts: -------------------------------------------------------------------------------- 1 | export type OrderingType = 2 | "String" | 3 | "Long" | 4 | "Double" | 5 | "AlphaNumeric"; 6 | -------------------------------------------------------------------------------- /src/Documents/Session/QueryEvents.ts: -------------------------------------------------------------------------------- 1 | import { IndexQuery } from "../Queries/IndexQuery.js"; 2 | import { QueryResult } from "../Queries/QueryResult.js"; 3 | import { TypedEventEmitter } from "../../Primitives/Events.js"; 4 | 5 | export interface StreamingQueryEvents { 6 | "afterStreamExecuted": object; 7 | } 8 | 9 | export interface QueryEvents extends StreamingQueryEvents { 10 | "beforeQueryExecuted": IndexQuery; 11 | "afterQueryExecuted": QueryResult; 12 | } 13 | 14 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 15 | export interface QueryEventsEmitter 16 | extends TypedEventEmitter { 17 | } 18 | -------------------------------------------------------------------------------- /src/Documents/Session/QueryOptions.ts: -------------------------------------------------------------------------------- 1 | import { DocumentType } from "../DocumentAbstractions.js"; 2 | import { AbstractCommonApiForIndexes } from "../Indexes/AbstractCommonApiForIndexes.js"; 3 | 4 | export interface DocumentQueryOptions { 5 | collection?: string; 6 | indexName?: string; 7 | index?: new () => AbstractCommonApiForIndexes; 8 | documentType?: DocumentType; 9 | } 10 | 11 | export interface AdvancedDocumentQueryOptions extends DocumentQueryOptions { 12 | isMapReduce?: boolean; 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Session/Querying/Sharding/IQueryShardedContextBuilder.ts: -------------------------------------------------------------------------------- 1 | export interface IQueryShardedContextBuilder { 2 | byDocumentId(id: string): IQueryShardedContextBuilder; 3 | byDocumentIds(ids: string[]): IQueryShardedContextBuilder; 4 | } -------------------------------------------------------------------------------- /src/Documents/Session/Querying/Sharding/QueryShardedContextBuilder.ts: -------------------------------------------------------------------------------- 1 | import { IQueryShardedContextBuilder } from "./IQueryShardedContextBuilder.js"; 2 | 3 | export class QueryShardedContextBuilder implements IQueryShardedContextBuilder { 4 | documentIds: Set = new Set(); 5 | 6 | byDocumentId(id: string): IQueryShardedContextBuilder { 7 | this.documentIds.add(id); 8 | return this; 9 | } 10 | 11 | byDocumentIds(ids: string[]): IQueryShardedContextBuilder { 12 | ids.forEach((id: string) => this.documentIds.add(id)); 13 | return this; 14 | } 15 | } -------------------------------------------------------------------------------- /src/Documents/Session/ResponseTimeInformation.ts: -------------------------------------------------------------------------------- 1 | export class ResponseTimeInformation { 2 | 3 | public totalServerDuration: number; 4 | public totalClientDuration: number; 5 | public durationBreakdown: ResponseTimeItem[]; 6 | 7 | public computeServerTotal(): void { 8 | this.totalServerDuration = 9 | this.durationBreakdown.reduce((result, next) => result + next.duration, 0); 10 | } 11 | 12 | constructor() { 13 | this.totalServerDuration = 0; 14 | this.totalClientDuration = 0; 15 | this.durationBreakdown = []; 16 | } 17 | } 18 | 19 | export interface ResponseTimeItem { 20 | url: string; 21 | duration: number; 22 | } 23 | -------------------------------------------------------------------------------- /src/Documents/Session/SessionOptions.ts: -------------------------------------------------------------------------------- 1 | import { RequestExecutor } from "../../Http/RequestExecutor.js"; 2 | import { TransactionMode } from "./TransactionMode.js"; 3 | import { ShardedBatchBehavior } from "./ShardedBatchBehavior.js"; 4 | 5 | export interface SessionOptions { 6 | database?: string; 7 | requestExecutor?: RequestExecutor; 8 | noTracking?: boolean; 9 | noCaching?: boolean; 10 | transactionMode?: TransactionMode; 11 | disableAtomicDocumentWritesInClusterWideTransaction?: boolean; 12 | shardedBatchBehavior?: ShardedBatchBehavior; 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Session/ShardedBatchBehavior.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export type ShardedBatchBehavior = 4 | /** 5 | * Do not force any behavior from the Client API and rely on Server's default 6 | */ 7 | "Default" 8 | /** 9 | * Allow to perform batch commands only on a single bucket, commands will be performed on single shard with ACID transaction guarantees. 10 | * A transaction that contains changes that belong to multiple buckets will be rejected by the server. 11 | */ 12 | | "TransactionalSingleBucketOnly" 13 | /** 14 | * Allow to spread batch commands to multiple buckets, commands can be performed on multiple shards without ACID transaction guarantees 15 | */ 16 | | "NonTransactionalMultiBucket" -------------------------------------------------------------------------------- /src/Documents/Session/StreamQueryStatistics.ts: -------------------------------------------------------------------------------- 1 | export interface StreamQueryStatistics { 2 | indexName: string; 3 | stale: boolean; 4 | indexTimestamp: Date; 5 | totalResults: number; 6 | resultEtag: number; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Session/TimeSeries/TimeSeriesValue.ts: -------------------------------------------------------------------------------- 1 | 2 | type OnlyNumbers = { [ P in keyof T]: T[P] extends number ? P : never }[keyof T]; 3 | 4 | type MappedField = { field: OnlyNumbers, name: string }; 5 | 6 | export type TimeSeriesValue = (OnlyNumbers | MappedField)[]; 7 | -------------------------------------------------------------------------------- /src/Documents/Session/TimeSeries/TypedTimeSeriesEntry.ts: -------------------------------------------------------------------------------- 1 | 2 | export class TypedTimeSeriesEntry { 3 | public timestamp: Date; 4 | public tag: string; 5 | public values: number[]; 6 | public isRollup: boolean; 7 | public value: T; 8 | } 9 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/CloseSubclauseToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | 3 | export class CloseSubclauseToken extends QueryToken { 4 | 5 | public boostParameterName: string; 6 | 7 | private constructor() { 8 | super(); 9 | } 10 | 11 | public static create(): CloseSubclauseToken { 12 | return new CloseSubclauseToken(); 13 | } 14 | 15 | public writeTo(writer): void { 16 | if (this.boostParameterName) { 17 | writer 18 | .append(", $") 19 | .append(this.boostParameterName); 20 | } 21 | writer.append(")"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/CompareExchangeValueIncludesToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | import { throwError } from "../../../Exceptions/index.js"; 3 | import { StringBuilder } from "../../../Utility/StringBuilder.js"; 4 | 5 | export class CompareExchangeValueIncludesToken extends QueryToken { 6 | private readonly _path: string; 7 | 8 | private constructor(path: string) { 9 | super(); 10 | 11 | if (!path) { 12 | throwError("InvalidArgumentException", "Path cannot be null"); 13 | } 14 | 15 | this._path = path; 16 | } 17 | 18 | public static create(path: string) { 19 | return new CompareExchangeValueIncludesToken(path); 20 | } 21 | 22 | writeTo(writer: StringBuilder) { 23 | writer 24 | .append("cmpxchg('") 25 | .append(this._path) 26 | .append("')"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/DistinctToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | 3 | export class DistinctToken extends QueryToken { 4 | 5 | private constructor() { 6 | super(); 7 | } 8 | 9 | public static INSTANCE: DistinctToken = new DistinctToken(); 10 | 11 | public writeTo(writer): void { 12 | writer.append("distinct"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/ExplanationToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | import { StringBuilder } from "../../../Utility/StringBuilder.js"; 3 | 4 | export class ExplanationToken extends QueryToken { 5 | private readonly _optionsParameterName: string; 6 | 7 | private constructor(optionsParameterName: string) { 8 | super(); 9 | this._optionsParameterName = optionsParameterName; 10 | } 11 | 12 | public static create(optionsParameterName: string): ExplanationToken { 13 | return new ExplanationToken(optionsParameterName); 14 | } 15 | 16 | public writeTo(writer: StringBuilder): void { 17 | writer.append("explanations("); 18 | if (this._optionsParameterName) { 19 | writer 20 | .append("$") 21 | .append(this._optionsParameterName); 22 | } 23 | 24 | writer.append(")"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/GroupByCountToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | 3 | export class GroupByCountToken extends QueryToken { 4 | 5 | private readonly _fieldName: string; 6 | 7 | private constructor(fieldName: string) { 8 | super(); 9 | this._fieldName = fieldName; 10 | } 11 | 12 | public static create(fieldName: string): GroupByCountToken { 13 | return new GroupByCountToken(fieldName); 14 | } 15 | 16 | public writeTo(writer): void { 17 | writer.append("count()"); 18 | 19 | if (!this._fieldName) { 20 | return; 21 | } 22 | 23 | writer.append(" as ") 24 | .append(this._fieldName); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/IntersectMarkerToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | 3 | export class IntersectMarkerToken extends QueryToken { 4 | 5 | private constructor() { 6 | super(); 7 | } 8 | 9 | public static INSTANCE: IntersectMarkerToken = new IntersectMarkerToken(); 10 | 11 | public writeTo(writer): void { 12 | writer.append(","); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/LoadToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | 3 | export class LoadToken extends QueryToken { 4 | 5 | public argument: string; 6 | public alias: string; 7 | 8 | private constructor(argument: string, alias: string) { 9 | super(); 10 | this.argument = argument; 11 | this.alias = alias; 12 | } 13 | 14 | public static create(argument: string, alias: string): LoadToken { 15 | return new LoadToken(argument, alias); 16 | } 17 | 18 | public writeTo(writer): void { 19 | writer 20 | .append(this.argument) 21 | .append(" as ") 22 | .append(this.alias); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/NegateToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | 3 | export class NegateToken extends QueryToken { 4 | private constructor() { 5 | super(); 6 | } 7 | 8 | public static INSTANCE: NegateToken = new NegateToken(); 9 | 10 | public writeTo(writer) { 11 | writer.append("not"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/OpenSubclauseToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | 3 | export class OpenSubclauseToken extends QueryToken { 4 | private constructor() { 5 | super(); 6 | } 7 | 8 | public boostParameterName: string; 9 | 10 | public static create(): OpenSubclauseToken { 11 | return new OpenSubclauseToken(); 12 | } 13 | 14 | public writeTo(writer) { 15 | if (this.boostParameterName) { 16 | writer.append("boost"); 17 | } 18 | writer.append("("); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/QueryOperatorToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryOperator } from "../../Queries/QueryOperator.js"; 2 | import { QueryToken } from "./QueryToken.js"; 3 | 4 | export class QueryOperatorToken extends QueryToken { 5 | 6 | private readonly _queryOperator: QueryOperator; 7 | 8 | private constructor(queryOperator: QueryOperator) { 9 | super(); 10 | this._queryOperator = queryOperator; 11 | } 12 | 13 | public static AND: QueryOperatorToken = new QueryOperatorToken("AND"); 14 | 15 | public static OR: QueryOperatorToken = new QueryOperatorToken("OR"); 16 | 17 | public writeTo(writer): void { 18 | if (this._queryOperator === "AND") { 19 | writer.append("and"); 20 | return; 21 | } 22 | 23 | writer.append("or"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/QueryToken.ts: -------------------------------------------------------------------------------- 1 | import { StringBuilder } from "../../../Utility/StringBuilder.js"; 2 | 3 | export abstract class QueryToken { 4 | 5 | public abstract writeTo(writer: StringBuilder); 6 | 7 | public static writeField(writer: StringBuilder, field: string) { 8 | const keyWord = QueryToken.isKeyword(field); 9 | if (keyWord) { 10 | writer.append("'"); 11 | } 12 | writer.append(field); 13 | 14 | if (keyWord) { 15 | writer.append("'"); 16 | } 17 | } 18 | 19 | public static isKeyword(field: string): boolean { 20 | return QueryToken.RQL_KEYWORDS.has(field); 21 | } 22 | 23 | private static RQL_KEYWORDS: Set = new Set([ 24 | "as", 25 | "select", 26 | "where", 27 | "load", 28 | "group", 29 | "order", 30 | "include", 31 | "filter" 32 | ]); 33 | } 34 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/TimingsToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | import { StringBuilder } from "../../../Utility/StringBuilder.js"; 3 | 4 | export class TimingsToken extends QueryToken { 5 | private constructor() { 6 | super(); 7 | } 8 | 9 | public static instance: TimingsToken = new TimingsToken(); 10 | 11 | public writeTo(writer: StringBuilder): void { 12 | writer.append("timings()"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/TrueToken.ts: -------------------------------------------------------------------------------- 1 | import { QueryToken } from "./QueryToken.js"; 2 | 3 | export class TrueToken extends QueryToken { 4 | 5 | private constructor() { 6 | super(); 7 | } 8 | 9 | public static INSTANCE: TrueToken = new TrueToken(); 10 | 11 | public writeTo(writer) { 12 | writer.append("true"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Session/Tokens/WhereOperator.ts: -------------------------------------------------------------------------------- 1 | export type WhereOperator = 2 | "Equals" 3 | | "NotEquals" 4 | | "GreaterThan" 5 | | "GreaterThanOrEqual" 6 | | "LessThan" 7 | | "LessThanOrEqual" 8 | | "In" 9 | | "AllIn" 10 | | "Between" 11 | | "Search" 12 | | "Lucene" 13 | | "StartsWith" 14 | | "EndsWith" 15 | | "Exists" 16 | | "SpatialWithin" 17 | | "SpatialContains" 18 | | "SpatialDisjoint" 19 | | "SpatialIntersects" 20 | | "Regex"; 21 | -------------------------------------------------------------------------------- /src/Documents/Session/TransactionMode.ts: -------------------------------------------------------------------------------- 1 | export type TransactionMode = "SingleNode" | "ClusterWide"; 2 | -------------------------------------------------------------------------------- /src/Documents/Session/WhereParams.ts: -------------------------------------------------------------------------------- 1 | export class WhereParams { 2 | public fieldName: string; 3 | public value: any; 4 | public allowWildcards: boolean = false; 5 | public nestedPath: boolean = false; 6 | public exact; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/SetupDocumentBase.ts: -------------------------------------------------------------------------------- 1 | export abstract class SetupDocumentBase { 2 | // this is dummy class which serves as marker for documents like MoreLikeThisStopWords, or FacetSetup 3 | // those documents are read by server, so it need PascalCase convention regardless of local casing configuration. 4 | 5 | public abstract toRemoteFieldNames(): any; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Smuggler/DatabaseItemType.ts: -------------------------------------------------------------------------------- 1 | export type DatabaseItemType = 2 | "None" 3 | | "Documents" 4 | | "RevisionDocuments" 5 | | "Indexes" 6 | | "Identities" 7 | | "Tombstones" 8 | | "LegacyAttachments" 9 | | "Conflicts" 10 | | "CompareExchange" 11 | | "LegacyDocumentDeletions" 12 | | "LegacyAttachmentDeletions" 13 | | "DatabaseRecord" 14 | | "Unknown" 15 | | "Attachments" 16 | | "CounterGroups" 17 | | "Subscriptions" 18 | | "CompareExchangeTombstones" 19 | | "TimeSeries" 20 | | "ReplicationHubCertificates"; -------------------------------------------------------------------------------- /src/Documents/Smuggler/DatabaseRecordItemType.ts: -------------------------------------------------------------------------------- 1 | export type DatabaseRecordItemType = 2 | "None" 3 | | "ConflictSolverConfig" 4 | | "Settings" 5 | | "Revisions" 6 | | "Expiration" 7 | | "PeriodicBackups" 8 | | "ExternalReplications" 9 | | "RavenConnectionStrings" 10 | | "SqlConnectionStrings" 11 | | "RavenEtls" 12 | | "SqlEtls" 13 | | "Client" 14 | | "Sorters" 15 | | "SinkPullReplications" 16 | | "HubPullReplications" 17 | | "TimeSeries" 18 | | "DocumentsCompression" 19 | | "Analyzers" 20 | | "LockMode" 21 | | "OlapConnectionStrings" 22 | | "OlapEtls" 23 | | "ElasticSearchConnectionStrings" 24 | | "ElasticSearchEtls" 25 | | "PostgreSqlIntegration" 26 | | "QueueConnectionStrings" 27 | | "QueueEtl" 28 | | "IndexesHistory" 29 | | "Refresh" 30 | | "QueueSinks" 31 | | "DataArchival"; 32 | -------------------------------------------------------------------------------- /src/Documents/Smuggler/DatabaseSmugglerExportOptions.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseSmugglerOptions } from "./DatabaseSmugglerOptions.js"; 2 | import { IDatabaseSmugglerExportOptions } from "./IDatabaseSmugglerExportOptions.js"; 3 | import { ExportCompressionAlgorithm } from "./ExportCompressionAlgorithm.js"; 4 | 5 | export class DatabaseSmugglerExportOptions extends DatabaseSmugglerOptions implements IDatabaseSmugglerExportOptions { 6 | compressionAlgorithm?: ExportCompressionAlgorithm; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Smuggler/ExportCompressionAlgorithm.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export type ExportCompressionAlgorithm = 4 | "Zstd" 5 | | "Gzip"; -------------------------------------------------------------------------------- /src/Documents/Smuggler/IDatabaseSmugglerExportOptions.ts: -------------------------------------------------------------------------------- 1 | import { IDatabaseSmugglerOptions } from "./IDatabaseSmugglerOptions.js"; 2 | import { ExportCompressionAlgorithm } from "./ExportCompressionAlgorithm.js"; 3 | 4 | export interface IDatabaseSmugglerExportOptions extends IDatabaseSmugglerOptions { 5 | collections: string[]; 6 | compressionAlgorithm?: ExportCompressionAlgorithm; 7 | } -------------------------------------------------------------------------------- /src/Documents/Smuggler/IDatabaseSmugglerImportOptions.ts: -------------------------------------------------------------------------------- 1 | import { IDatabaseSmugglerOptions } from "./IDatabaseSmugglerOptions.js"; 2 | 3 | export interface IDatabaseSmugglerImportOptions extends IDatabaseSmugglerOptions { 4 | skipRevisionCreation: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Smuggler/IDatabaseSmugglerOptions.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseItemType } from "./DatabaseItemType.js"; 2 | import { DatabaseRecordItemType } from "./DatabaseRecordItemType.js"; 3 | 4 | export interface IDatabaseSmugglerOptions { 5 | operateOnTypes: DatabaseItemType[]; 6 | includeExpired: boolean; 7 | includeArtificial: boolean; 8 | includeArchived: boolean; 9 | removeAnalyzers: boolean; 10 | transformScript: string; 11 | maxStepsForTransformScript: number; 12 | skipRevisionCreation: boolean; 13 | collections: string[]; 14 | operateOnDatabaseRecordType: DatabaseRecordItemType[]; 15 | } 16 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/BatchFromServer.ts: -------------------------------------------------------------------------------- 1 | import { SubscriptionConnectionServerMessage } from "./SubscriptionConnectionServerMessage.js"; 2 | 3 | export interface BatchFromServer { 4 | messages: SubscriptionConnectionServerMessage[]; 5 | includes: object[]; 6 | counterIncludes: CounterIncludeItem[]; 7 | timeSeriesIncludes: object[]; 8 | } 9 | 10 | export interface CounterIncludeItem { 11 | includes: object; 12 | counterIncludes: Record; 13 | } -------------------------------------------------------------------------------- /src/Documents/Subscriptions/CreateSubscriptionResult.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface CreateSubscriptionResult { 3 | name: string; 4 | raftCommandIndex?: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/GetSubscriptionsResult.ts: -------------------------------------------------------------------------------- 1 | import { SubscriptionState } from "./SubscriptionState.js"; 2 | 3 | export interface GetSubscriptionsResult { 4 | results: SubscriptionState[]; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/NodeId.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface NodeId { 3 | nodeTag: string; 4 | nodeUrl: string; 5 | responsibleNode: string; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/Revision.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface Revision { 3 | previous: T; 4 | current: T; 5 | } 6 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionConnectionClientMessage.ts: -------------------------------------------------------------------------------- 1 | export interface SubscriptionConnectionClientMessage { 2 | type: MessageType; 3 | changeVector: string; 4 | 5 | } 6 | 7 | export type MessageType = "None" | "Acknowledge" | "DisposedNotification"; 8 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionCreationOptions.ts: -------------------------------------------------------------------------------- 1 | import { DocumentType } from "../DocumentAbstractions.js"; 2 | import { ISubscriptionIncludeBuilder } from "../Session/Loaders/ISubscriptionIncludeBuilder.js"; 3 | import { ArchivedDataProcessingBehavior } from "../DataArchival/ArchivedDataProcessingBehavior.js"; 4 | 5 | export interface SubscriptionCreationOptions { 6 | name?: string; 7 | query?: string; 8 | includes?: (builder: ISubscriptionIncludeBuilder) => void; 9 | changeVector?: string; 10 | mentorNode?: string; 11 | pinToMentorNode?: boolean; 12 | archivedDataProcessingBehavior?: ArchivedDataProcessingBehavior; 13 | disabled?: boolean; 14 | documentType?: DocumentType; 15 | } 16 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionMode.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export type SubscriptionMode = 4 | "None" 5 | | "Single" 6 | | "Concurrent"; -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionShardingState.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface SubscriptionShardingState { 3 | changeVectorForNextBatchStartingPointPerShard: Record; 4 | nodeTagPerShard: Record; 5 | processedChangeVectorPerBucket: Record; 6 | changeVectorForNextBatchStartingPointForOrchestrator: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionState.ts: -------------------------------------------------------------------------------- 1 | import { ArchivedDataProcessingBehavior } from "../DataArchival/ArchivedDataProcessingBehavior.js"; 2 | import { SubscriptionShardingState } from "./SubscriptionShardingState.js"; 3 | 4 | export interface SubscriptionState { 5 | query: string; 6 | changeVectorForNextBatchStartingPoint: string; 7 | subscriptionId: number; 8 | subscriptionName: string; 9 | mentorNode: string; 10 | nodeTag: string; 11 | lastBatchAckTime: string; 12 | lastClientConnectionTime: string; 13 | raftCommandIndex: number; 14 | disabled: boolean; 15 | archivedDataProcessingBehavior: ArchivedDataProcessingBehavior; 16 | shardingState: SubscriptionShardingState; 17 | } 18 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionStateWithNodeDetails.ts: -------------------------------------------------------------------------------- 1 | import { SubscriptionState } from "./SubscriptionState.js"; 2 | import { NodeId } from "./NodeId.js"; 3 | 4 | export interface SubscriptionStateWithNodeDetails extends SubscriptionState { 5 | responsibleNode: NodeId; 6 | } 7 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionTryout.ts: -------------------------------------------------------------------------------- 1 | import { ArchivedDataProcessingBehavior } from "../DataArchival/ArchivedDataProcessingBehavior.js"; 2 | 3 | export interface SubscriptionTryout { 4 | changeVector: string; 5 | query: string; 6 | archivedDataProcessingBehavior: ArchivedDataProcessingBehavior; 7 | } 8 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionUpdateOptions.ts: -------------------------------------------------------------------------------- 1 | import { SubscriptionCreationOptions } from "./SubscriptionCreationOptions.js"; 2 | 3 | export interface SubscriptionUpdateOptions extends SubscriptionCreationOptions { 4 | id?: number; 5 | createNew?: boolean; 6 | } -------------------------------------------------------------------------------- /src/Documents/Subscriptions/SubscriptionWorkerOptions.ts: -------------------------------------------------------------------------------- 1 | import { SubscriptionOpeningStrategy } from "./SubscriptionOpeningStrategy.js"; 2 | import { DocumentType } from "../DocumentAbstractions.js"; 3 | 4 | export interface SubscriptionWorkerOptions { 5 | subscriptionName?: string; 6 | timeToWaitBeforeConnectionRetry?: number; 7 | ignoreSubscriberErrors?: boolean; 8 | strategy?: SubscriptionOpeningStrategy; 9 | maxDocsPerBatch?: number; 10 | maxErroneousPeriod?: number; 11 | closeWhenNoDocsLeft?: boolean; 12 | documentType?: DocumentType; 13 | workerId?: string; 14 | } 15 | -------------------------------------------------------------------------------- /src/Documents/Subscriptions/UpdateSubscriptionResult.ts: -------------------------------------------------------------------------------- 1 | import { CreateSubscriptionResult } from "./CreateSubscriptionResult.js"; 2 | 3 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 4 | export interface UpdateSubscriptionResult extends CreateSubscriptionResult { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/Http/AggressiveCacheOptions.ts: -------------------------------------------------------------------------------- 1 | export class AggressiveCacheOptions { 2 | public duration: number; 3 | } 4 | -------------------------------------------------------------------------------- /src/Http/Behaviors/AbstractCommandResponseBehavior.ts: -------------------------------------------------------------------------------- 1 | import { RavenCommand } from "../RavenCommand.js"; 2 | import { HttpResponse } from "../../Primitives/Http.js"; 3 | 4 | 5 | export abstract class AbstractCommandResponseBehavior { 6 | public abstract handleNotModified(command: RavenCommand, response: Response, cachedValue: string): Promise; 7 | 8 | public abstract tryHandleNotFound(command: RavenCommand, response: Response): Promise; 9 | 10 | public abstract tryHandleConflict(response: HttpResponse, body: string): boolean; 11 | 12 | public abstract tryHandleUnsuccessfulResponse(command: RavenCommand, response: Response, body: string): boolean; 13 | } 14 | -------------------------------------------------------------------------------- /src/Http/CurrentIndexAndNode.ts: -------------------------------------------------------------------------------- 1 | import { ServerNode } from "./ServerNode.js"; 2 | 3 | export default class CurrentIndexAndNode { 4 | public currentIndex: number; 5 | public currentNode: ServerNode; 6 | 7 | constructor(currentIndex: number, currentNode: ServerNode) { 8 | this.currentIndex = currentIndex; 9 | this.currentNode = currentNode; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Http/CurrentIndexAndNodeAndEtag.ts: -------------------------------------------------------------------------------- 1 | import { ServerNode } from "./ServerNode.js"; 2 | 3 | export interface CurrentIndexAndNodeAndEtag { 4 | currentIndex: number; 5 | currentNode: ServerNode; 6 | topologyEtag: number; 7 | } -------------------------------------------------------------------------------- /src/Http/HttpCompressionAlgorithm.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export type HttpCompressionAlgorithm = "Gzip"; 4 | -------------------------------------------------------------------------------- /src/Http/IBroadcast.ts: -------------------------------------------------------------------------------- 1 | import { DocumentConventions } from "../Documents/Conventions/DocumentConventions.js"; 2 | 3 | export interface IBroadcast { 4 | prepareToBroadcast(conventions: DocumentConventions): IBroadcast; 5 | } -------------------------------------------------------------------------------- /src/Http/IRaftCommand.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IRaftCommand { 3 | getRaftUniqueRequestId(): string; 4 | } -------------------------------------------------------------------------------- /src/Http/LoadBalanceBehavior.ts: -------------------------------------------------------------------------------- 1 | 2 | export type LoadBalanceBehavior = "None" | "UseSessionContext"; -------------------------------------------------------------------------------- /src/Http/ReadBalanceBehavior.ts: -------------------------------------------------------------------------------- 1 | export type ReadBalanceBehavior = "None" | "RoundRobin" | "FastestNode"; 2 | -------------------------------------------------------------------------------- /src/Http/Topology.ts: -------------------------------------------------------------------------------- 1 | import { ServerNode } from "./ServerNode.js"; 2 | 3 | export class Topology { 4 | public etag: number = 0; 5 | public nodes?: ServerNode[] = null; 6 | public promotables?: ServerNode[] = null; 7 | 8 | constructor(etag: number = 0, nodes: ServerNode[] = null, promotables: ServerNode[] = null) { 9 | this.etag = etag; 10 | this.nodes = nodes || []; 11 | this.promotables = promotables || []; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Http/UpdateTopologyParameters.ts: -------------------------------------------------------------------------------- 1 | import { ServerNode } from "./ServerNode.js"; 2 | import { throwError } from "../Exceptions/index.js"; 3 | 4 | export class UpdateTopologyParameters { 5 | 6 | public readonly node: ServerNode; 7 | public timeoutInMs: number = 15_000; 8 | public forceUpdate: boolean; 9 | public debugTag: string; 10 | public applicationIdentifier: string; 11 | 12 | public constructor(node: ServerNode) { 13 | if (!node) { 14 | throwError("InvalidArgumentException", "Node cannot be null"); 15 | } 16 | 17 | this.node = node; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Http/UriUtility.ts: -------------------------------------------------------------------------------- 1 | import { TypeUtil } from "../Utility/TypeUtil.js"; 2 | 3 | export class UriUtility { 4 | public static parseUrls(urls: string | string[]): string[] { 5 | return (TypeUtil.isArray(urls) ? urls as string[] : [urls as string]) 6 | .reduce((accumulator: string[], iteratee: string | string[]): string[] => 7 | accumulator.concat((TypeUtil.isArray(iteratee) ? iteratee as string[] 8 | : (iteratee as string).split(/[,;]/).map((url: string): string => url.trim()) 9 | .filter((url: string): boolean => !!url)) 10 | ), []); 11 | } 12 | 13 | public static isSecure(url: string): boolean { 14 | return 0 === url.toLowerCase().indexOf("https"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Mapping/Json/Replacers.ts: -------------------------------------------------------------------------------- 1 | export function pascalCaseReplacer(key, value) { 2 | if (value && typeof value === "object" && !Array.isArray(value)) { 3 | const replacement = {}; 4 | for (const k in value) { 5 | if (Object.hasOwnProperty.call(value, k)) { 6 | replacement[k && k.charAt(0).toUpperCase() + k.slice(1)] = value[k]; 7 | } 8 | } 9 | return replacement; 10 | } 11 | 12 | return value; 13 | } 14 | 15 | export function camelCaseReplacer(key, value) { 16 | if (value && typeof value === "object" && !Array.isArray(value)) { 17 | const replacement = {}; 18 | for (const k in value) { 19 | if (Object.hasOwnProperty.call(value, k)) { 20 | replacement[k && k.charAt(0).toLowerCase() + k.slice(1)] = value[k]; 21 | } 22 | } 23 | 24 | return replacement; 25 | } 26 | 27 | return value; 28 | } 29 | -------------------------------------------------------------------------------- /src/Mapping/Json/Revivers.ts: -------------------------------------------------------------------------------- 1 | export function camelCaseReviver(key: string, value: unknown) { 2 | if (key && !Array.isArray(this)) { 3 | const newKey = key.charAt(0).toLowerCase() + key.slice(1); 4 | if (key !== newKey) { 5 | this[newKey] = value; 6 | } else { 7 | return value; 8 | } 9 | } else { 10 | return value; 11 | } 12 | } 13 | 14 | export function pascalCaseReviver(key: string, value: unknown) { 15 | if (key && !Array.isArray(this)) { 16 | const newKey = key.charAt(0).toUpperCase() + key.slice(1); 17 | if (key !== newKey) { 18 | this[newKey] = value; 19 | return; 20 | } else { 21 | return value; 22 | } 23 | } 24 | 25 | return value; 26 | } 27 | -------------------------------------------------------------------------------- /src/Mapping/Json/Streams/CollectResultStream.ts: -------------------------------------------------------------------------------- 1 | import { Writable } from "node:stream"; 2 | 3 | export class CollectResultStream extends Writable { 4 | 5 | private _result: TResult; 6 | private readonly _resultPromise: Promise; 7 | 8 | get promise(): Promise { 9 | return this._resultPromise as Promise; 10 | } 11 | 12 | constructor() { 13 | super({ objectMode: true }); 14 | 15 | this._resultPromise = new Promise((resolve, reject) => { 16 | this.once("finish", () => resolve(this._result)); 17 | }); 18 | } 19 | 20 | public _write(chunk, enc, callback) { 21 | this._result = chunk; 22 | callback(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Mapping/Json/index.ts: -------------------------------------------------------------------------------- 1 | import { CONSTANTS } from "../../Constants.js"; 2 | 3 | export * from "./Replacers.js"; 4 | export * from "./Revivers.js"; 5 | 6 | export function tryGetConflict(metadata: object): boolean { 7 | return metadata[CONSTANTS.Documents.Metadata.CONFLICT] || false; 8 | } 9 | -------------------------------------------------------------------------------- /src/Primitives/CaseInsensitiveKeysStore.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export class CaseInsensitiveKeysStore { 4 | 5 | private _originalKeys: Map = new Map(); 6 | 7 | public getKey(key: string) { 8 | return this._originalKeys.get( 9 | this.normalizeKey(key)); 10 | } 11 | 12 | public getKeys(): IterableIterator { 13 | return this._originalKeys.values(); 14 | } 15 | 16 | public setKey(origKey: string): string { 17 | const lowerKey = this.normalizeKey(origKey); 18 | this._originalKeys.set(lowerKey, origKey); 19 | return lowerKey; 20 | } 21 | 22 | public deleteKey(origKey: string): string { 23 | const lowerKey = this.normalizeKey(origKey); 24 | this._originalKeys.delete(lowerKey); 25 | return lowerKey; 26 | } 27 | 28 | public normalizeKey(key: string) { 29 | return key ? key.toLowerCase() : key; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Primitives/Http.ts: -------------------------------------------------------------------------------- 1 | 2 | export type HttpRequestParameters = RequestInit & { 3 | uri: string; 4 | fetcher?: any; 5 | }; 6 | export type HttpRequestParametersWithoutUri = RequestInit & { 7 | fetcher?: any; 8 | }; 9 | export type HttpResponse = Response; 10 | export type HttpRequest = Request; 11 | -------------------------------------------------------------------------------- /src/Primitives/TimeValueUnit.ts: -------------------------------------------------------------------------------- 1 | 2 | export type TimeValueUnit = "None" | "Second" | "Month"; -------------------------------------------------------------------------------- /src/ServerWide/Commands/NodeInfo.ts: -------------------------------------------------------------------------------- 1 | import { BuildNumber } from "../Operations/BuildNumber.js"; 2 | import { ServerNodeRole } from "../../Http/ServerNode.js"; 3 | 4 | export interface NodeInfo { 5 | nodeTag: string; 6 | topologyId: string; 7 | certificate: string; 8 | clusterStatus: string; 9 | numberOfCores: number; 10 | installedMemoryInGb: number; 11 | usableMemoryInGb: number; 12 | buildInfo: BuildNumber; 13 | serverRole: ServerNodeRole; 14 | hasFixedPort: boolean; 15 | serverSchemaVersion: number; 16 | } 17 | -------------------------------------------------------------------------------- /src/ServerWide/CompactSettings.ts: -------------------------------------------------------------------------------- 1 | export interface CompactSettings { 2 | databaseName: string; 3 | documents?: boolean; 4 | indexes?: string[]; 5 | skipOptimizeIndexes?: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /src/ServerWide/DeletionInProgressStatus.ts: -------------------------------------------------------------------------------- 1 | 2 | export type DeletionInProgressStatus = 3 | "No" 4 | | "SoftDelete" 5 | | "HardDelete"; -------------------------------------------------------------------------------- /src/ServerWide/DocumentsCompressionConfiguration.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface DocumentsCompressionConfiguration { 3 | collections?: string[]; 4 | compressRevisions?: boolean; 5 | compressAllCollections?: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /src/ServerWide/IDatabaseTaskStatus.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IDatabaseTaskStatus { 3 | nodeTag: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/ServerWide/ModifyOnGoingTaskResult.ts: -------------------------------------------------------------------------------- 1 | export interface ModifyOngoingTaskResult { 2 | taskId: number; 3 | raftCommandIndex: number; 4 | responsibleNode: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/BuildNumber.ts: -------------------------------------------------------------------------------- 1 | export interface BuildNumber { 2 | productVersion: string; 3 | buildVersion: number; 4 | commitHash: string; 5 | fullVersion: string; 6 | assemblyVersion: string; 7 | } -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IBackupConfigurationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { PeriodicBackupConfiguration } from "../../../Documents/Operations/Backups/PeriodicBackupConfiguration.js"; 2 | 3 | export interface IBackupConfigurationBuilder { 4 | addPeriodicBackup(configuration: PeriodicBackupConfiguration): this; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IConnectionStringConfigurationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ElasticSearchConnectionString, 3 | OlapConnectionString, QueueConnectionString, 4 | RavenConnectionString, 5 | SqlConnectionString 6 | } from "../../../Documents/Operations/Etl/ConnectionString.js"; 7 | 8 | export interface IConnectionStringConfigurationBuilder { 9 | addRavenConnectionString(connectionString: RavenConnectionString): this; 10 | addSqlConnectionString(connectionString: SqlConnectionString): this; 11 | addOlapConnectionString(connectionString: OlapConnectionString): this; 12 | addElasticSearchConnectionString(connectionString: ElasticSearchConnectionString): this; 13 | addQueueConnectionString(connectionString: QueueConnectionString): this; 14 | } 15 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IDatabaseRecordBuilder.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseTopology } from "../index.js"; 2 | import { ITopologyConfigurationBuilder } from "./ITopologyConfigurationBuilder.js"; 3 | import { IDatabaseRecordBuilderBase } from "./IDatabaseRecordBuilderBase.js"; 4 | 5 | export interface IDatabaseRecordBuilder extends IDatabaseRecordBuilderBase { 6 | withTopology(topology: DatabaseTopology): this; 7 | withTopology(builder: (builder: ITopologyConfigurationBuilder) => void): this; 8 | withReplicationFactor(replicationFactor: number): this; 9 | } 10 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IDatabaseRecordBuilderInitializer.ts: -------------------------------------------------------------------------------- 1 | import { IDatabaseRecordBuilder } from "./IDatabaseRecordBuilder.js"; 2 | import { IShardedTopologyConfigurationBuilder } from "./IShardedTopologyConfigurationBuilder.js"; 3 | import { DatabaseRecord } from "../../index.js"; 4 | 5 | export interface IDatabaseRecordBuilderInitializer { 6 | regular(databaseName: string): IDatabaseRecordBuilder; 7 | sharded(databaseName: string, builder: (builder: IShardedTopologyConfigurationBuilder) => void): this; 8 | toDatabaseRecord(): DatabaseRecord; 9 | } 10 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IIntegrationConfigurationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { PostgreSqlConfiguration } from "../Integrations/PostgreSql/PostgreSqlConfiguration.js"; 2 | 3 | export interface IIntegrationConfigurationBuilder { 4 | configurePostgreSql(configuration: PostgreSqlConfiguration): this; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IOrchestratorTopologyConfigurationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { ITopologyConfigurationBuilderBase } from "./ITopologyConfigurationBuilderBase.js"; 2 | 3 | export interface IOrchestratorTopologyConfigurationBuilder extends ITopologyConfigurationBuilderBase { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IReplicationConfigurationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { ExternalReplication } from "../../../Documents/Replication/ExternalReplication.js"; 2 | import { PullReplicationAsSink } from "../../../Documents/Operations/Replication/PullReplicationAsSink.js"; 3 | import { PullReplicationDefinition } from "../../../Documents/Operations/Replication/PullReplicationDefinition.js"; 4 | 5 | export interface IReplicationConfigurationBuilder { 6 | addExternalReplication(configuration: ExternalReplication): this; 7 | addPullReplicationSink(configuration: PullReplicationAsSink): this; 8 | addPullReplicationHub(configuration: PullReplicationDefinition): this; 9 | } 10 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IShardTopologyConfigurationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { ITopologyConfigurationBuilderBase } from "./ITopologyConfigurationBuilderBase.js"; 2 | 3 | export interface IShardTopologyConfigurationBuilder extends ITopologyConfigurationBuilderBase { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IShardedDatabaseRecordBuilder.ts: -------------------------------------------------------------------------------- 1 | import { IDatabaseRecordBuilderBase } from "./IDatabaseRecordBuilderBase.js"; 2 | 3 | export interface IShardedDatabaseRecordBuilder extends IDatabaseRecordBuilderBase { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/IShardedTopologyConfigurationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { OrchestratorTopology } from "../../OrchestratorTopology.js"; 2 | import { DatabaseTopology } from "../index.js"; 3 | import { IOrchestratorTopologyConfigurationBuilder } from "./IOrchestratorTopologyConfigurationBuilder.js"; 4 | import { IShardTopologyConfigurationBuilder } from "./IShardTopologyConfigurationBuilder.js"; 5 | 6 | export interface IShardedTopologyConfigurationBuilder { 7 | orchestrator(topology: OrchestratorTopology): this; 8 | orchestrator(builder: (builder: IOrchestratorTopologyConfigurationBuilder) => void): this; 9 | addShard(shardNumber: number, topology: DatabaseTopology): this; 10 | addShard(shardNumber: number, builder: (builder: IShardTopologyConfigurationBuilder) => void): this; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/ITopologyConfigurationBuilder.ts: -------------------------------------------------------------------------------- 1 | import { ITopologyConfigurationBuilderBase } from "./ITopologyConfigurationBuilderBase.js"; 2 | 3 | export interface ITopologyConfigurationBuilder extends ITopologyConfigurationBuilderBase { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Builder/ITopologyConfigurationBuilderBase.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ITopologyConfigurationBuilderBase { 3 | addNode(nodeTag: string): TSelf; 4 | enableDynamicNodesDistribution(): TSelf; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Certificates/CertificateDefinition.ts: -------------------------------------------------------------------------------- 1 | import { CertificateMetadata } from "./CertificateMetadata.js"; 2 | 3 | export interface CertificateDefinition extends CertificateMetadata { 4 | certificate: string; 5 | password?: string; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Certificates/CertificateMetadata.ts: -------------------------------------------------------------------------------- 1 | import { SecurityClearance } from "./SecurityClearance.js"; 2 | import { DatabaseAccess } from "./DatabaseAccess.js"; 3 | 4 | export interface CertificateMetadata { 5 | name: string; 6 | securityClearance: SecurityClearance; 7 | thumbprint: string; 8 | notAfter: Date; 9 | notBefore: Date; 10 | permissions?: Record; 11 | collectionSecondaryKeys?: string[]; 12 | collectionPrimaryKey?: string; 13 | publicKeyPinningHash: string; 14 | } 15 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Certificates/CertificateRawData.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface CertificateRawData { 3 | /** 4 | * Certificate raw data - this certificate is zip archive 5 | */ 6 | rawData: Buffer; 7 | } -------------------------------------------------------------------------------- /src/ServerWide/Operations/Certificates/DatabaseAccess.ts: -------------------------------------------------------------------------------- 1 | 2 | export type DatabaseAccess = 3 | "ReadWrite" 4 | | "Admin" 5 | | "Read"; -------------------------------------------------------------------------------- /src/ServerWide/Operations/Certificates/GetCertificatesResponse.ts: -------------------------------------------------------------------------------- 1 | import { CertificateDefinition } from "./CertificateDefinition.js"; 2 | 3 | export interface GetCertificatesResponse { 4 | results: CertificateDefinition[]; 5 | } -------------------------------------------------------------------------------- /src/ServerWide/Operations/Certificates/SecurityClearance.ts: -------------------------------------------------------------------------------- 1 | 2 | export type SecurityClearance = 3 | "UnauthenticatedClients" 4 | | "ClusterAdmin" 5 | | "ClusterNode" 6 | | "Operator" 7 | | "ValidUser"; 8 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Configuration/DatabaseSettings.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface DatabaseSettings { 4 | settings: Record; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Configuration/ServerWideBackupConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { PeriodicBackupConfiguration } from "../../../Documents/Operations/Backups/PeriodicBackupConfiguration.js"; 2 | import { IServerWideTask } from "../OngoingTasks/IServerWideTask.js"; 3 | 4 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 5 | export interface ServerWideBackupConfiguration extends PeriodicBackupConfiguration, IServerWideTask { 6 | } 7 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/DocumentsCompression/DocumentCompressionConfigurationResult.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface DocumentCompressionConfigurationResult { 4 | raftCommandIndex: number; 5 | } -------------------------------------------------------------------------------- /src/ServerWide/Operations/Integrations/PostgreSql/IntegrationConfigurations.ts: -------------------------------------------------------------------------------- 1 | import { PostgreSqlConfiguration } from "./PostgreSqlConfiguration.js"; 2 | 3 | export interface IntegrationConfigurations { 4 | postgreSql: PostgreSqlConfiguration; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Integrations/PostgreSql/PostgreSqlAuthenticationConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { PostgreSqlUser } from "./PostgreSqlUser.js"; 2 | 3 | export interface PostgreSqlAuthenticationConfiguration { 4 | users: PostgreSqlUser[]; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Integrations/PostgreSql/PostgreSqlConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { PostgreSqlAuthenticationConfiguration } from "./PostgreSqlAuthenticationConfiguration.js"; 2 | 3 | export interface PostgreSqlConfiguration { 4 | authentication?: PostgreSqlAuthenticationConfiguration; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Integrations/PostgreSql/PostgreSqlUser.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface PostgreSqlUser { 3 | username: string; 4 | password: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/Logs/GetLogsConfigurationResult.ts: -------------------------------------------------------------------------------- 1 | import { LogMode } from "./LogMode.js"; 2 | 3 | export interface GetLogsConfigurationResult { 4 | currentMode: LogMode; 5 | mode: LogMode; 6 | path: string; 7 | useUtcTime: boolean; 8 | retentionTime: string; 9 | retentionSize: number; 10 | compress: boolean; 11 | } -------------------------------------------------------------------------------- /src/ServerWide/Operations/Logs/LogMode.ts: -------------------------------------------------------------------------------- 1 | 2 | export type LogMode = 3 | "None" 4 | | "Operations" 5 | | "Information"; 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/ModifyDatabaseTopologyResult.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface ModifyDatabaseTopologyResult { 4 | raftCommandIndex: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/OngoingTasks/IServerWideTask.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface IServerWideTask { 3 | excludedDatabases?: string[]; 4 | } -------------------------------------------------------------------------------- /src/ServerWide/Operations/OngoingTasks/ServerWideExternalReplication.ts: -------------------------------------------------------------------------------- 1 | import { IExternalReplication } from "../../../Documents/Operations/Replication/IExternalReplication.js"; 2 | import { IServerWideTask } from "./IServerWideTask.js"; 3 | 4 | export interface ServerWideExternalReplication extends IExternalReplication, IServerWideTask { 5 | topologyDiscoveryUrls: string[]; 6 | } 7 | -------------------------------------------------------------------------------- /src/ServerWide/Operations/OngoingTasks/ServerWideTaskResponse.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ServerWideTaskResponse { 3 | name: string; 4 | raftCommandIndex: number; 5 | } 6 | 7 | 8 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 9 | export interface PutServerWideBackupConfigurationResponse extends ServerWideTaskResponse { 10 | } 11 | 12 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 13 | export interface ServerWideExternalReplicationResponse extends ServerWideTaskResponse { 14 | } 15 | -------------------------------------------------------------------------------- /src/ServerWide/OrchestratorTopology.ts: -------------------------------------------------------------------------------- 1 | import { DatabaseTopology } from "./Operations/index.js"; 2 | 3 | export interface OrchestratorTopology extends DatabaseTopology { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Sharding/MigrationStatus.ts: -------------------------------------------------------------------------------- 1 | export type MigrationStatus = 2 | "Pending" 3 | /** 4 | * source is in progress of sending the bucket 5 | */ 6 | | "Moving" 7 | /** 8 | * the source has completed to send everything he has 9 | * and the destinations member nodes start confirm having all docs 10 | * at this stage writes will still go to the source shard 11 | */ 12 | | "Moved" 13 | /** 14 | * all member nodes confirmed receiving the bucket 15 | * the mapping is updated so any traffic will go now to the destination 16 | * the source will start the cleanup process 17 | */ 18 | | "OwnershipTransferred"; -------------------------------------------------------------------------------- /src/ServerWide/Sharding/OrchestratorConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { OrchestratorTopology } from "../OrchestratorTopology.js"; 2 | 3 | export interface OrchestratorConfiguration { 4 | topology: OrchestratorTopology; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Sharding/PrefixedShardingSetting.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface PrefixedShardingSetting { 3 | prefix: string; 4 | shards: number[]; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Sharding/ShardBucketMigration.ts: -------------------------------------------------------------------------------- 1 | import { MigrationStatus } from "./MigrationStatus.js"; 2 | 3 | export interface ShardBucketMigration { 4 | status: MigrationStatus; 5 | bucket: number; 6 | sourceShard: number; 7 | destinationShard: number; 8 | migrationIndex: number; 9 | confirmationIndex: number; 10 | lastSourceChangeVector: string; 11 | 12 | confirmedDestinations: string[]; 13 | confirmedSourceCleanup: string[]; 14 | 15 | mentorNode: string; 16 | } -------------------------------------------------------------------------------- /src/ServerWide/Sharding/ShardBucketRange.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface ShardBucketRange { 3 | bucketRangeStart: number; 4 | shardNumber: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Sharding/ShardingConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { OrchestratorConfiguration } from "./OrchestratorConfiguration.js"; 2 | import { DatabaseTopology } from "../Operations/index.js"; 3 | import { ShardBucketRange } from "./ShardBucketRange.js"; 4 | import { PrefixedShardingSetting } from "./PrefixedShardingSetting.js"; 5 | import { ShardBucketMigration } from "./ShardBucketMigration.js"; 6 | 7 | export interface ShardingConfiguration { 8 | orchestrator: OrchestratorConfiguration; 9 | shards: { [shard: number]: DatabaseTopology }; 10 | bucketRanges: ShardBucketRange[]; 11 | prefixed: PrefixedShardingSetting[]; 12 | bucketMigrations: { [bucket: number]: ShardBucketMigration }; 13 | migrationCutOffIndex: number; 14 | databaseId: string; 15 | } -------------------------------------------------------------------------------- /src/ServerWide/Tcp/LicensedFeatures.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface LicensedFeatures { 4 | dataCompression: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /src/ServerWide/Tcp/TcpConnectionHeaderResponse.ts: -------------------------------------------------------------------------------- 1 | import { TcpConnectionStatus } from "./TcpConnectionStatus.js"; 2 | import { LicensedFeatures } from "./LicensedFeatures.js"; 3 | 4 | export interface TcpConnectionHeaderResponse { 5 | status: TcpConnectionStatus; 6 | message: string; 7 | version: number; 8 | licensedFeatures: LicensedFeatures; 9 | } 10 | -------------------------------------------------------------------------------- /src/ServerWide/Tcp/TcpConnectionStatus.ts: -------------------------------------------------------------------------------- 1 | 2 | export type TcpConnectionStatus = "Ok" | "AuthorizationFailed" | "TcpVersionMismatch" | "InvalidNetworkTopology"; 3 | -------------------------------------------------------------------------------- /src/ServerWide/Tcp/TcpNegotiateParameters.ts: -------------------------------------------------------------------------------- 1 | import { AuthorizationInfo, OperationTypes } from "./TcpConnectionHeaderMessage.js"; 2 | import { Socket } from "node:net"; 3 | import { TcpNegotiationResponse } from "./TcpNegotiationResponse.js"; 4 | import { LicensedFeatures } from "./LicensedFeatures.js"; 5 | 6 | export interface TcpNegotiateParameters { 7 | operation: OperationTypes; 8 | authorizeInfo?: AuthorizationInfo; 9 | version: number; 10 | database: string; 11 | sourceNodeTag?: string; 12 | destinationNodeTag: string; 13 | destinationUrl: string; 14 | destinationServerId: string; 15 | licensedFeatures: LicensedFeatures; 16 | readResponseAndGetVersionCallback: (url: string, socket: Socket) => Promise; 17 | } 18 | -------------------------------------------------------------------------------- /src/ServerWide/Tcp/TcpNegotiationResponse.ts: -------------------------------------------------------------------------------- 1 | import { LicensedFeatures } from "./LicensedFeatures.js"; 2 | 3 | 4 | export interface TcpNegotiationResponse { 5 | version: number; 6 | licensedFeatures: LicensedFeatures; 7 | } 8 | -------------------------------------------------------------------------------- /src/Types/Callbacks.ts: -------------------------------------------------------------------------------- 1 | export type ErrorFirstCallback = (error?: Error, result?: TResult) => void; 2 | 3 | export type EmptyCallback = ErrorFirstCallback; 4 | 5 | export type ValueCallback = (result: T) => void; 6 | -------------------------------------------------------------------------------- /src/Types/Contracts.ts: -------------------------------------------------------------------------------- 1 | export interface IDisposable { 2 | dispose(): T; 3 | } 4 | -------------------------------------------------------------------------------- /src/Types/IRavenObject.ts: -------------------------------------------------------------------------------- 1 | export interface IRavenObject { 2 | [property: string]: T; 3 | } 4 | -------------------------------------------------------------------------------- /src/Utility/ArrayUtil.ts: -------------------------------------------------------------------------------- 1 | export class ArrayUtil { 2 | 3 | public static range(n: number, func: (idx: number) => T) { 4 | return new Array(n) 5 | .fill(null).map((x, i) => func(i)); 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/Utility/ImportUtil.ts: -------------------------------------------------------------------------------- 1 | export function importFix(name: string) { 2 | // fix to avoid static analysis on cloudflare environment. 3 | return name + ""; 4 | } -------------------------------------------------------------------------------- /src/Utility/OsUtil.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export const EOL = "\r\n"; -------------------------------------------------------------------------------- /src/Utility/RaftIdGenerator.ts: -------------------------------------------------------------------------------- 1 | import { randomUUID } from "node:crypto"; 2 | 3 | export class RaftIdGenerator { 4 | public static newId(): string { 5 | return randomUUID(); 6 | } 7 | 8 | // if the don't care id is used it may cause that on retry/resend of the command we will end up in double applying of the command (once for the original request and for the retry). 9 | public static dontCareId(): string { 10 | return ""; 11 | } 12 | } -------------------------------------------------------------------------------- /src/Utility/Reference.ts: -------------------------------------------------------------------------------- 1 | export interface Reference { 2 | value: T; 3 | } -------------------------------------------------------------------------------- /src/Utility/SizeUtil.ts: -------------------------------------------------------------------------------- 1 | export interface Size { 2 | sizeInBytes: number; 3 | humaneSize: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/Utility/Stopwatch.ts: -------------------------------------------------------------------------------- 1 | export class Stopwatch { 2 | 3 | private _startDate: Date; 4 | private _endDate: Date; 5 | 6 | public start() { 7 | this._startDate = new Date(); 8 | } 9 | 10 | public stop() { 11 | this._endDate = new Date(); 12 | } 13 | 14 | public get elapsed(): number { 15 | if (!this._startDate) { 16 | return 0; 17 | } 18 | 19 | if (!this._endDate) { 20 | return Date.now() - this._startDate.valueOf(); 21 | } 22 | 23 | return this._endDate.valueOf() - this._startDate.valueOf(); 24 | } 25 | 26 | public static createStarted() { 27 | const s = new Stopwatch(); 28 | s.start(); 29 | return s; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/Utility/StringBuilder.ts: -------------------------------------------------------------------------------- 1 | import { Stream } from "node:stream"; 2 | import { EOL } from "./OsUtil.js"; 3 | 4 | export class StringBuilder { 5 | private s: any[] = []; 6 | private readonly newline: string; 7 | 8 | public constructor(v?: any) { 9 | this.append(v); 10 | 11 | Stream.call(this); 12 | 13 | this.newline = EOL; 14 | } 15 | 16 | public append(v: any) { 17 | if (v != null) { 18 | this.s.push(v); 19 | } 20 | 21 | return this; 22 | } 23 | 24 | public appendLine(v: any) { 25 | this.s.push(this.newline); 26 | 27 | if (v != null) { 28 | this.s.push(v); 29 | } 30 | 31 | return this; 32 | } 33 | 34 | public clear() { 35 | this.s.length = 0; 36 | } 37 | 38 | public toString() { 39 | return this.s.length === 0 ? "" : this.s.join(""); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Utility/UriUtil.ts: -------------------------------------------------------------------------------- 1 | import { throwError } from "../Exceptions/index.js"; 2 | 3 | export function isValidUri(uriString: string): boolean { 4 | try { 5 | new URL(uriString); 6 | return true; 7 | } catch { 8 | return false; 9 | } 10 | } 11 | 12 | export function validateUri(uriString: string): void { 13 | if (!isValidUri(uriString)) { 14 | throwError("InvalidArgumentException", `Uri ${uriString} is invalid.`); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ext/stream-json/jsonl/Stringer.ts: -------------------------------------------------------------------------------- 1 | 2 | import { Transform } from "node:stream"; 3 | 4 | export class JsonlStringer extends Transform { 5 | _replacer: any; 6 | 7 | static make(options) { 8 | return new JsonlStringer(options); 9 | } 10 | 11 | constructor(options) { 12 | super(Object.assign({}, options, {writableObjectMode: true, readableObjectMode: false})); 13 | this._replacer = options && options.replacer; 14 | } 15 | 16 | _transform(chunk, _, callback) { 17 | this.push(JSON.stringify(chunk, this._replacer)); 18 | this._transform = this._nextTransform; 19 | callback(null); 20 | } 21 | 22 | _nextTransform(chunk, _, callback) { 23 | this.push('\n' + JSON.stringify(chunk, this._replacer)); 24 | callback(null); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ext/stream-json/streamers/StreamValues.ts: -------------------------------------------------------------------------------- 1 | import { StreamBase } from './StreamBase.js'; 2 | 3 | export class StreamValues extends StreamBase { 4 | static make(options) { 5 | return new StreamValues(options); 6 | } 7 | 8 | static streamValues = StreamValues.make; 9 | 10 | _counter: any; 11 | 12 | constructor(options = undefined) { 13 | super(options); 14 | this._counter = 0; 15 | this._level = 0; 16 | } 17 | 18 | _push(discard) { 19 | if (discard) { 20 | ++this._counter; 21 | } else { 22 | this.push({key: this._counter++, value: this._assembler.current}); 23 | } 24 | this._assembler.current = this._assembler.key = null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Assets/Faceted.ts: -------------------------------------------------------------------------------- 1 | 2 | export type Currency = "USD" | "EUR" | "NIS"; 3 | 4 | export class Order { 5 | public product: string; 6 | public total: number; 7 | public currency: Currency; 8 | public quantity: number; 9 | public region: number = 0; 10 | public at: Date; 11 | public tax: number; 12 | } 13 | -------------------------------------------------------------------------------- /test/Assets/Samples.ts: -------------------------------------------------------------------------------- 1 | 2 | export class Dog { 3 | public id: string; 4 | public name: string; 5 | public likes: string[]; 6 | public dislikes: string[]; 7 | } 8 | 9 | export class Entity { 10 | public id: string; 11 | public name: string; 12 | public references: string; 13 | } 14 | 15 | export class Genre { 16 | public id: string; 17 | public name: string; 18 | } 19 | 20 | export class Movie { 21 | public id: string; 22 | public name: string; 23 | public genres: string[]; 24 | } 25 | 26 | export class User { 27 | public id: string; 28 | public name: string; 29 | public age: number; 30 | public hasRated: Rating[]; 31 | } 32 | 33 | export class Rating { 34 | public movie: string; 35 | public score: number; 36 | } -------------------------------------------------------------------------------- /test/Assets/test_cert.conf: -------------------------------------------------------------------------------- 1 | [req] 2 | distinguished_name = req_distinguished_name 3 | 4 | [req_distinguished_name] 5 | 6 | [ext] 7 | subjectKeyIdentifier = hash 8 | authorityKeyIdentifier = keyid:always 9 | keyUsage = digitalSignature,keyEncipherment 10 | extendedKeyUsage=serverAuth,clientAuth 11 | -------------------------------------------------------------------------------- /test/Assets/tubes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ravendb/ravendb-nodejs-client/9acb938abc88cde3a0dce110bcd1dcd63ad717ab/test/Assets/tubes.png -------------------------------------------------------------------------------- /test/Documents/Commands/GetNextOperationIdCommandTests.ts: -------------------------------------------------------------------------------- 1 | import assert from "node:assert" 2 | import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil.js"; 3 | 4 | import { 5 | GetNextOperationIdCommand, 6 | IDocumentStore, 7 | } from "../../../src/index.js"; 8 | 9 | describe("GetNextOperationIdCommand", function () { 10 | 11 | let store: IDocumentStore; 12 | 13 | beforeEach(async function () { 14 | store = await testContext.getDocumentStore(); 15 | }); 16 | 17 | afterEach(async () => 18 | await disposeTestDocumentStore(store)); 19 | 20 | it("can get next operation ID", async () => { 21 | const command = new GetNextOperationIdCommand(); 22 | await store.getRequestExecutor().execute(command); 23 | assert.ok(command.result); 24 | assert.ok(typeof command.result === "number"); 25 | assert.ok(!Number.isNaN(command.result)); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /test/Issues/RDBC_202.ts: -------------------------------------------------------------------------------- 1 | import { 2 | DocumentStore, 3 | IAuthOptions 4 | } from "../../src/index.js"; 5 | import assert from "node:assert" 6 | 7 | describe("[RDBC-202] DocumentStore", function () { 8 | 9 | it("allows to pass authOptions as a third param in DocumentStore constructor", () => { 10 | const authOptions: IAuthOptions = {}; 11 | const store = new DocumentStore("https://test.com", "db", authOptions); 12 | assert.strictEqual(store.authOptions, authOptions); 13 | }); 14 | 15 | }); 16 | -------------------------------------------------------------------------------- /test/Issues/RDBC_543.ts: -------------------------------------------------------------------------------- 1 | import { IDocumentStore } from "../../src/index.js"; 2 | import { disposeTestDocumentStore, testContext } from "../Utils/TestUtil.js"; 3 | 4 | describe("RDBC-543", function () { 5 | 6 | let store: IDocumentStore; 7 | 8 | beforeEach(async function () { 9 | store = await testContext.getDocumentStore(); 10 | }); 11 | 12 | afterEach(async () => 13 | await disposeTestDocumentStore(store)); 14 | 15 | it("can store object w/o prototype", async () => { 16 | const session = store.openSession(); 17 | const ravenModel: any = { 18 | name: "John" 19 | }; 20 | 21 | const nullObj = Object.create(null); 22 | 23 | ravenModel.someProp = nullObj; 24 | await session.store(ravenModel); 25 | await session.saveChanges(); 26 | }) 27 | }); 28 | -------------------------------------------------------------------------------- /test/Ported/Documents/Commands/CanGetBuildNumberTest.ts: -------------------------------------------------------------------------------- 1 | import { disposeTestDocumentStore, testContext } from "../../../Utils/TestUtil.js"; 2 | import { IDocumentStore, GetBuildNumberOperation } from "../../../../src/index.js"; 3 | import { assertThat } from "../../../Utils/AssertExtensions.js"; 4 | 5 | describe("CanGetBuildNumberTest", function () { 6 | 7 | let store: IDocumentStore; 8 | 9 | beforeEach(async function () { 10 | store = await testContext.getDocumentStore(); 11 | }); 12 | 13 | afterEach(async () => 14 | await disposeTestDocumentStore(store)); 15 | 16 | it("canGetBuildNumber", async () => { 17 | const buildNumber = await store.maintenance.server.send(new GetBuildNumberOperation()); 18 | 19 | assertThat(buildNumber) 20 | .isNotNull(); 21 | assertThat(buildNumber.productVersion) 22 | .isNotNull(); 23 | }); 24 | 25 | }); -------------------------------------------------------------------------------- /test/Ported/Documents/Commands/ReorderDatabaseMembersTest.ts: -------------------------------------------------------------------------------- 1 | import { IDocumentStore, ReorderDatabaseMembersOperation } from "../../../../src/index.js"; 2 | import { disposeTestDocumentStore, testContext } from "../../../Utils/TestUtil.js"; 3 | 4 | describe("ReorderDatabaseMembersTest", function () { 5 | 6 | let store: IDocumentStore; 7 | 8 | beforeEach(async function () { 9 | store = await testContext.getDocumentStore(); 10 | }); 11 | 12 | afterEach(async () => 13 | await disposeTestDocumentStore(store)); 14 | 15 | it("canSendReorderCommand", async () => { 16 | await store.maintenance.send(new ReorderDatabaseMembersOperation(store.database, ["A"])); 17 | }); 18 | 19 | }); 20 | -------------------------------------------------------------------------------- /test/Ported/Issues/RDBC_693.ts: -------------------------------------------------------------------------------- 1 | import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil.js"; 2 | 3 | import { 4 | IDocumentStore, 5 | GetDatabaseRecordOperation, 6 | } from "../../../src/index.js"; 7 | import { assertThat } from "../../Utils/AssertExtensions.js"; 8 | 9 | describe("RDBC_693", function () { 10 | 11 | let store: IDocumentStore; 12 | 13 | beforeEach(async function () { 14 | store = await testContext.getDocumentStore(); 15 | }); 16 | 17 | afterEach(async () => 18 | await disposeTestDocumentStore(store)); 19 | 20 | it("can handle 404 in GetDatabaseRecordOperation", async () => { 21 | const dbRecord = await store.maintenance.server.send(new GetDatabaseRecordOperation("DB_WHICH_DOESNT_EXIST")); 22 | assertThat(dbRecord) 23 | .isNull(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /test/Ported/Queries/QueriesWithIncludesTests.ts: -------------------------------------------------------------------------------- 1 | import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil.js"; 2 | 3 | import { 4 | IDocumentStore, 5 | } from "../../../src/index.js"; 6 | 7 | describe("Query with includes", function () { 8 | 9 | let store: IDocumentStore; 10 | 11 | beforeEach(async function () { 12 | store = await testContext.getDocumentStore(); 13 | }); 14 | 15 | afterEach(async () => 16 | await disposeTestDocumentStore(store)); 17 | 18 | it.skip("TODO"); 19 | }); 20 | -------------------------------------------------------------------------------- /test/Ported/Server/PromoteDatabaseTest.ts: -------------------------------------------------------------------------------- 1 | import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil.js"; 2 | import { 3 | IDocumentStore, 4 | PromoteDatabaseNodeOperation 5 | } from "../../../src/index.js"; 6 | 7 | describe("PromoteDatabaseTest", function () { 8 | 9 | let store: IDocumentStore; 10 | 11 | beforeEach(async function () { 12 | store = await testContext.getDocumentStore(); 13 | }); 14 | 15 | afterEach(async () => 16 | await disposeTestDocumentStore(store)); 17 | 18 | it("canSendPromoteDatabaseCommand", async () => { 19 | const operation = new PromoteDatabaseNodeOperation(store.database, "A"); 20 | await store.maintenance.server.send(operation); 21 | 22 | // since we are running single node cluster we cannot assert much 23 | }); 24 | 25 | }); 26 | -------------------------------------------------------------------------------- /test/Utils/Streams.ts: -------------------------------------------------------------------------------- 1 | import { Writable } from "node:stream"; 2 | 3 | export function getStringWritable(): Writable { 4 | let buf = ""; 5 | const result = new Writable({ 6 | write(chunk, enc, callback) { 7 | buf += chunk.toString(); 8 | callback(); 9 | }, 10 | final(callback) { 11 | (this as any).string = buf; 12 | callback(); 13 | } 14 | }); 15 | 16 | return result; 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig.imports-check.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | 4 | "include": [ 5 | "./src/**/*" 6 | ], 7 | "exclude": [ 8 | "node_modules", 9 | "lib" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.9.2", 3 | "compilerOptions": { 4 | "target": "ES2022", 5 | "module": "Node16", 6 | "inlineSources": true, 7 | "moduleResolution": "Node16", 8 | "esModuleInterop": false, 9 | "allowSyntheticDefaultImports": true, 10 | "declarationMap": true, 11 | "outDir": "dist", 12 | "declaration": true, 13 | "experimentalDecorators": true, 14 | "sourceMap": true, 15 | "pretty": true, 16 | "lib": [ "ES2022" ], 17 | "typeRoots": [ 18 | "node_modules/@types", 19 | "src/Types" 20 | ], 21 | "types": [ 22 | "node", 23 | "mocha" 24 | ] 25 | }, 26 | "files": [ 27 | "./src/index.ts" 28 | ], 29 | "exclude": [ 30 | "node_modules", 31 | "lib", 32 | "dist" 33 | ], 34 | "ts-node": { 35 | "swc": true 36 | } 37 | } 38 | --------------------------------------------------------------------------------