couchbase 4.6.0 → 4.7.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +2 -1
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +66 -93
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
- package/deps/couchbase-cxx-client/CMakeLists.txt +24 -11
- package/deps/couchbase-cxx-client/README.md +17 -16
- package/deps/couchbase-cxx-client/cmake/APKBUILD.in +17 -1
- package/deps/couchbase-cxx-client/cmake/Bundler.cmake +9 -1
- package/deps/couchbase-cxx-client/cmake/Cache.cmake +48 -19
- package/deps/couchbase-cxx-client/cmake/CompilerOptions.cmake +3 -1
- package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +10 -2
- package/deps/couchbase-cxx-client/cmake/Packaging.cmake +48 -8
- package/deps/couchbase-cxx-client/cmake/ThirdPartyDependencies.cmake +43 -1
- package/deps/couchbase-cxx-client/cmake/build_config.hxx.in +2 -0
- package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.spec.in +18 -0
- package/deps/couchbase-cxx-client/cmake/debian/control +6 -1
- package/deps/couchbase-cxx-client/cmake/debian/rules +1 -0
- package/deps/couchbase-cxx-client/cmake/tarball_glob.txt +10 -0
- package/deps/couchbase-cxx-client/core/app_telemetry_meter.cxx +1 -0
- package/deps/couchbase-cxx-client/core/app_telemetry_reporter.cxx +45 -43
- package/deps/couchbase-cxx-client/core/app_telemetry_reporter.hxx +4 -3
- package/deps/couchbase-cxx-client/core/bucket.cxx +128 -13
- package/deps/couchbase-cxx-client/core/bucket.hxx +12 -2
- package/deps/couchbase-cxx-client/core/cluster.cxx +304 -152
- package/deps/couchbase-cxx-client/core/cluster.hxx +32 -0
- package/deps/couchbase-cxx-client/core/cluster_credentials.cxx +25 -0
- package/deps/couchbase-cxx-client/core/cluster_credentials.hxx +5 -0
- package/deps/couchbase-cxx-client/core/cluster_label_listener.cxx +72 -0
- package/deps/couchbase-cxx-client/core/cluster_label_listener.hxx +46 -0
- package/deps/couchbase-cxx-client/core/cluster_options.hxx +4 -0
- package/deps/couchbase-cxx-client/core/deprecation_utils.hxx +26 -0
- package/deps/couchbase-cxx-client/core/error.hxx +27 -0
- package/deps/couchbase-cxx-client/core/free_form_http_request.hxx +0 -2
- package/deps/couchbase-cxx-client/core/http_component.cxx +12 -48
- package/deps/couchbase-cxx-client/core/impl/analytics.cxx +3 -2
- package/deps/couchbase-cxx-client/core/impl/analytics.hxx +2 -1
- package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +249 -137
- package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +134 -58
- package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +87 -35
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +560 -245
- package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +89 -49
- package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.cxx +4 -4
- package/deps/couchbase-cxx-client/core/impl/error.cxx +20 -13
- package/deps/couchbase-cxx-client/core/impl/error.hxx +15 -10
- package/deps/couchbase-cxx-client/core/impl/get_all_replicas.hxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/get_any_replica.hxx +2 -1
- package/deps/couchbase-cxx-client/core/impl/get_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/observability_recorder.cxx +161 -0
- package/deps/couchbase-cxx-client/core/impl/observability_recorder.hxx +77 -0
- package/deps/couchbase-cxx-client/core/impl/observe_seqno.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/public_bucket.cxx +31 -7
- package/deps/couchbase-cxx-client/core/impl/public_cluster.cxx +107 -19
- package/deps/couchbase-cxx-client/core/impl/query.cxx +6 -3
- package/deps/couchbase-cxx-client/core/impl/query.hxx +3 -1
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +267 -102
- package/deps/couchbase-cxx-client/core/impl/scope.cxx +53 -11
- package/deps/couchbase-cxx-client/core/impl/search.cxx +8 -4
- package/deps/couchbase-cxx-client/core/impl/search.hxx +6 -2
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +131 -41
- package/deps/couchbase-cxx-client/core/impl/with_cancellation.hxx +75 -0
- package/deps/couchbase-cxx-client/core/io/config_tracker.cxx +9 -9
- package/deps/couchbase-cxx-client/core/io/config_tracker.hxx +2 -1
- package/deps/couchbase-cxx-client/core/io/http_command.hxx +98 -49
- package/deps/couchbase-cxx-client/core/io/http_context.hxx +2 -0
- package/deps/couchbase-cxx-client/core/io/http_session.cxx +23 -10
- package/deps/couchbase-cxx-client/core/io/http_session.hxx +17 -9
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +163 -228
- package/deps/couchbase-cxx-client/core/io/http_traits.hxx +0 -7
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +123 -44
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +251 -26
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +9 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_traits.hxx +0 -8
- package/deps/couchbase-cxx-client/core/io/streams.cxx +3 -3
- package/deps/couchbase-cxx-client/core/io/streams.hxx +3 -2
- package/deps/couchbase-cxx-client/core/meta/features.hxx +15 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +13 -0
- package/deps/couchbase-cxx-client/core/meta/version.hxx +3 -0
- package/deps/couchbase-cxx-client/core/metrics/constants.hxx +23 -0
- package/deps/couchbase-cxx-client/core/metrics/logging_meter.cxx +5 -5
- package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.cxx +65 -63
- package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.hxx +12 -10
- package/deps/couchbase-cxx-client/core/operations/document_analytics.hxx +0 -5
- package/deps/couchbase-cxx-client/core/operations/document_append.hxx +0 -4
- package/deps/couchbase-cxx-client/core/operations/document_decrement.hxx +0 -5
- package/deps/couchbase-cxx-client/core/operations/document_exists.hxx +0 -7
- package/deps/couchbase-cxx-client/core/operations/document_get.hxx +0 -7
- package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +77 -27
- package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.hxx +0 -9
- package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.hxx +0 -9
- package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +83 -2
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.hxx +0 -9
- package/deps/couchbase-cxx-client/core/operations/document_increment.hxx +0 -5
- package/deps/couchbase-cxx-client/core/operations/document_insert.hxx +0 -4
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in.hxx +0 -9
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +46 -4
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +121 -43
- package/deps/couchbase-cxx-client/core/operations/document_mutate_in.hxx +0 -5
- package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +0 -4
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +0 -4
- package/deps/couchbase-cxx-client/core/operations/document_remove.hxx +0 -4
- package/deps/couchbase-cxx-client/core/operations/document_replace.hxx +0 -4
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +0 -7
- package/deps/couchbase-cxx-client/core/operations/document_touch.hxx +0 -7
- package/deps/couchbase-cxx-client/core/operations/document_unlock.hxx +0 -6
- package/deps/couchbase-cxx-client/core/operations/document_upsert.hxx +0 -4
- package/deps/couchbase-cxx-client/core/operations/document_view.cxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +10 -13
- package/deps/couchbase-cxx-client/core/operations/http_noop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_update.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/change_password.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +4 -1
- package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/freeform.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_upsert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +68 -30
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +4 -3
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/role_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/operation_traits.hxx +6 -0
- package/deps/couchbase-cxx-client/core/operations.hxx +0 -1
- package/deps/couchbase-cxx-client/core/operations_fwd.hxx +8 -0
- package/deps/couchbase-cxx-client/core/origin.cxx +67 -12
- package/deps/couchbase-cxx-client/core/origin.hxx +13 -8
- package/deps/couchbase-cxx-client/core/orphan_reporter.cxx +164 -0
- package/deps/couchbase-cxx-client/core/orphan_reporter.hxx +65 -0
- package/deps/couchbase-cxx-client/core/sasl/CMakeLists.txt +1 -0
- package/deps/couchbase-cxx-client/core/sasl/client.cc +6 -0
- package/deps/couchbase-cxx-client/core/sasl/mechanism.cc +2 -1
- package/deps/couchbase-cxx-client/core/sasl/mechanism.h +2 -1
- package/deps/couchbase-cxx-client/core/sasl/oauthbearer/oauthbearer.cc +41 -0
- package/deps/couchbase-cxx-client/core/sasl/oauthbearer/oauthbearer.h +47 -0
- package/deps/couchbase-cxx-client/core/tls_context_provider.cxx +44 -0
- package/deps/couchbase-cxx-client/core/tls_context_provider.hxx +44 -0
- package/deps/couchbase-cxx-client/core/tracing/attribute_helpers.hxx +45 -0
- package/deps/couchbase-cxx-client/core/tracing/constants.hxx +148 -68
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_options.hxx +0 -3
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.cxx +122 -170
- package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.cxx +17 -24
- package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.hxx +8 -10
- package/deps/couchbase-cxx-client/core/tracing/wrapper_sdk_tracer.cxx +114 -0
- package/deps/couchbase-cxx-client/core/tracing/wrapper_sdk_tracer.hxx +85 -0
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +16 -14
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +4 -4
- package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +1 -1
- package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +1 -2
- package/deps/couchbase-cxx-client/core/utils/byteswap.hxx +12 -0
- package/deps/couchbase-cxx-client/core/utils/concurrent_fixed_priority_queue.hxx +102 -0
- package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +2 -0
- package/deps/couchbase-cxx-client/couchbase/certificate_authenticator.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +47 -0
- package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +16 -0
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +60 -15
- package/deps/couchbase-cxx-client/couchbase/error_codes.hxx +48 -48
- package/deps/couchbase-cxx-client/couchbase/jwt_authenticator.hxx +52 -0
- package/deps/couchbase-cxx-client/couchbase/metrics/meter.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/metrics/otel_meter.hxx +75 -80
- package/deps/couchbase-cxx-client/couchbase/network_options.hxx +19 -0
- package/deps/couchbase-cxx-client/couchbase/password_authenticator.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/tracing/otel_tracer.hxx +15 -17
- package/deps/couchbase-cxx-client/couchbase/tracing/request_span.hxx +2 -2
- package/dist/analyticsexecutor.d.ts +15 -0
- package/dist/analyticsexecutor.js +79 -50
- package/dist/analyticsindexmanager.d.ts +66 -0
- package/dist/analyticsindexmanager.js +404 -277
- package/dist/analyticstypes.d.ts +5 -0
- package/dist/authenticators.d.ts +34 -1
- package/dist/authenticators.js +19 -1
- package/dist/binarycollection.d.ts +17 -0
- package/dist/binding.d.ts +245 -228
- package/dist/binding.js +2 -2
- package/dist/bindingutilities.js +1 -1
- package/dist/bucket.d.ts +8 -0
- package/dist/bucket.js +8 -0
- package/dist/bucketmanager.d.ts +30 -0
- package/dist/bucketmanager.js +128 -69
- package/dist/cluster.d.ts +45 -0
- package/dist/cluster.js +133 -23
- package/dist/collection.d.ts +75 -2
- package/dist/collection.js +773 -552
- package/dist/collectionmanager.d.ts +34 -0
- package/dist/collectionmanager.js +172 -89
- package/dist/couchbase.d.ts +5 -0
- package/dist/couchbase.js +5 -0
- package/dist/datastructures.js +310 -97
- package/dist/diagnosticsexecutor.js +1 -1
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +12 -1
- package/dist/eventingfunctionmanager.d.ts +42 -0
- package/dist/eventingfunctionmanager.js +172 -100
- package/dist/logger.d.ts +192 -0
- package/dist/logger.js +213 -0
- package/dist/loggingmeter.d.ts +120 -0
- package/dist/loggingmeter.js +226 -0
- package/dist/metrics.d.ts +33 -0
- package/dist/metrics.js +5 -0
- package/dist/observability.d.ts +60 -0
- package/dist/observability.js +86 -0
- package/dist/observabilityhandler.d.ts +176 -0
- package/dist/observabilityhandler.js +733 -0
- package/dist/observabilitytypes.d.ts +320 -0
- package/dist/observabilitytypes.js +362 -0
- package/dist/observabilityutilities.d.ts +60 -0
- package/dist/observabilityutilities.js +175 -0
- package/dist/otelmeter.d.ts +51 -0
- package/dist/otelmeter.js +100 -0
- package/dist/oteltracer.d.ts +69 -0
- package/dist/oteltracer.js +141 -0
- package/dist/queryexecutor.d.ts +16 -0
- package/dist/queryexecutor.js +128 -86
- package/dist/queryindexmanager.d.ts +29 -0
- package/dist/queryindexmanager.js +277 -150
- package/dist/querytypes.d.ts +5 -0
- package/dist/scope.js +2 -2
- package/dist/scopeeventingfunctionmanager.d.ts +5 -0
- package/dist/scopeeventingfunctionmanager.js +217 -119
- package/dist/scopesearchindexmanager.d.ts +5 -0
- package/dist/scopesearchindexmanager.js +295 -166
- package/dist/sdspecs.js +6 -1
- package/dist/searchexecutor.d.ts +15 -0
- package/dist/searchexecutor.js +54 -26
- package/dist/searchindexmanager.d.ts +54 -0
- package/dist/searchindexmanager.js +235 -142
- package/dist/searchtypes.d.ts +5 -0
- package/dist/thresholdlogging.d.ts +301 -0
- package/dist/thresholdlogging.js +657 -0
- package/dist/tracing.d.ts +55 -0
- package/dist/tracing.js +2 -0
- package/dist/transactions.js +1 -1
- package/dist/transcoders.js +1 -1
- package/dist/usermanager.d.ts +46 -0
- package/dist/usermanager.js +199 -118
- package/dist/utilities.d.ts +4 -0
- package/dist/utilities.js +11 -1
- package/dist/utilities_internal.js +0 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.js +7 -0
- package/dist/viewexecutor.d.ts +15 -0
- package/dist/viewexecutor.js +54 -29
- package/dist/viewindexmanager.d.ts +30 -0
- package/dist/viewindexmanager.js +129 -100
- package/dist/viewtypes.d.ts +5 -0
- package/package.json +32 -18
- package/scripts/buildPrebuild.js +2 -0
- package/scripts/install.js +2 -0
- package/scripts/prebuilds.js +7 -8
- package/scripts/prune.js +2 -0
- package/scripts/updateVersion.js +26 -0
- package/src/connection.cpp +79 -98
- package/src/connection.hpp +46 -38
- package/src/connection_autogen.cpp +1236 -292
- package/src/jstocbpp_autogen.hpp +1117 -313
- package/src/jstocbpp_basic.hpp +73 -0
- package/src/jstocbpp_defs.hpp +37 -9
- package/src/jstocbpp_errors.hpp +37 -11
- package/tools/gen-bindings-js.js +100 -22
- package/tools/gen-bindings-json.py +40 -6
- package/src/transcoder.hpp +0 -96
package/dist/datastructures.js
CHANGED
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CouchbaseSet = exports.CouchbaseQueue = exports.CouchbaseMap = exports.CouchbaseList = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
5
|
const generaltypes_1 = require("./generaltypes");
|
|
6
|
+
const observabilityhandler_1 = require("./observabilityhandler");
|
|
7
|
+
const observabilitytypes_1 = require("./observabilitytypes");
|
|
6
8
|
const sdspecs_1 = require("./sdspecs");
|
|
7
9
|
const utilities_1 = require("./utilities");
|
|
8
10
|
/**
|
|
@@ -20,8 +22,8 @@ class CouchbaseList {
|
|
|
20
22
|
this._coll = collection;
|
|
21
23
|
this._key = key;
|
|
22
24
|
}
|
|
23
|
-
async _get() {
|
|
24
|
-
const doc = await this._coll.get(this._key);
|
|
25
|
+
async _get(parentSpan) {
|
|
26
|
+
const doc = await this._coll.get(this._key, { parentSpan: parentSpan });
|
|
25
27
|
if (!(doc.content instanceof Array)) {
|
|
26
28
|
throw new errors_1.CouchbaseError('expected document of array type');
|
|
27
29
|
}
|
|
@@ -33,8 +35,18 @@ class CouchbaseList {
|
|
|
33
35
|
* @param callback A node-style callback to be invoked after execution.
|
|
34
36
|
*/
|
|
35
37
|
async getAll(callback) {
|
|
38
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.ListGetAll, this._coll.observabilityInstruments);
|
|
39
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
36
40
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
37
|
-
|
|
41
|
+
try {
|
|
42
|
+
const res = await this._get(obsReqHandler.wrappedSpan);
|
|
43
|
+
obsReqHandler.end();
|
|
44
|
+
return res;
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
obsReqHandler.endWithError(e);
|
|
48
|
+
throw e;
|
|
49
|
+
}
|
|
38
50
|
}, callback);
|
|
39
51
|
}
|
|
40
52
|
/**
|
|
@@ -79,15 +91,22 @@ class CouchbaseList {
|
|
|
79
91
|
* @param callback A node-style callback to be invoked after execution.
|
|
80
92
|
*/
|
|
81
93
|
async getAt(index, callback) {
|
|
94
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.ListGetAt, this._coll.observabilityInstruments);
|
|
95
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
82
96
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
83
|
-
|
|
84
|
-
sdspecs_1.LookupInSpec.get('[' + index + ']'),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
try {
|
|
98
|
+
const res = await this._coll.lookupIn(this._key, [sdspecs_1.LookupInSpec.get('[' + index + ']')], { parentSpan: obsReqHandler.wrappedSpan });
|
|
99
|
+
const itemRes = res.content[0];
|
|
100
|
+
if (itemRes.error) {
|
|
101
|
+
throw itemRes.error;
|
|
102
|
+
}
|
|
103
|
+
obsReqHandler.end();
|
|
104
|
+
return itemRes.value;
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
obsReqHandler.endWithError(e);
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
91
110
|
}, callback);
|
|
92
111
|
}
|
|
93
112
|
/**
|
|
@@ -97,10 +116,17 @@ class CouchbaseList {
|
|
|
97
116
|
* @param callback A node-style callback to be invoked after execution.
|
|
98
117
|
*/
|
|
99
118
|
async removeAt(index, callback) {
|
|
119
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.ListRemoveAt, this._coll.observabilityInstruments);
|
|
120
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
100
121
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
101
|
-
|
|
102
|
-
sdspecs_1.MutateInSpec.remove('[' + index + ']'),
|
|
103
|
-
|
|
122
|
+
try {
|
|
123
|
+
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.remove('[' + index + ']')], { parentSpan: obsReqHandler.wrappedSpan });
|
|
124
|
+
obsReqHandler.end();
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
obsReqHandler.endWithError(e);
|
|
128
|
+
throw e;
|
|
129
|
+
}
|
|
104
130
|
}, callback);
|
|
105
131
|
}
|
|
106
132
|
/**
|
|
@@ -110,14 +136,24 @@ class CouchbaseList {
|
|
|
110
136
|
* @param callback A node-style callback to be invoked after execution.
|
|
111
137
|
*/
|
|
112
138
|
async indexOf(value, callback) {
|
|
139
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.ListIndexOf, this._coll.observabilityInstruments);
|
|
140
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
113
141
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
142
|
+
try {
|
|
143
|
+
const items = await this._get(obsReqHandler.wrappedSpan);
|
|
144
|
+
for (let i = 0; i < items.length; ++i) {
|
|
145
|
+
if (items[i] === value) {
|
|
146
|
+
obsReqHandler.end();
|
|
147
|
+
return i;
|
|
148
|
+
}
|
|
118
149
|
}
|
|
150
|
+
obsReqHandler.end();
|
|
151
|
+
return -1;
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
obsReqHandler.endWithError(e);
|
|
155
|
+
throw e;
|
|
119
156
|
}
|
|
120
|
-
return -1;
|
|
121
157
|
}, callback);
|
|
122
158
|
}
|
|
123
159
|
/**
|
|
@@ -126,9 +162,18 @@ class CouchbaseList {
|
|
|
126
162
|
* @param callback A node-style callback to be invoked after execution.
|
|
127
163
|
*/
|
|
128
164
|
async size(callback) {
|
|
165
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.ListSize, this._coll.observabilityInstruments);
|
|
166
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
129
167
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
130
|
-
|
|
131
|
-
|
|
168
|
+
try {
|
|
169
|
+
const res = await this._coll.lookupIn(this._key, [sdspecs_1.LookupInSpec.count('')], { parentSpan: obsReqHandler.wrappedSpan });
|
|
170
|
+
obsReqHandler.end();
|
|
171
|
+
return res.content[0].value;
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
obsReqHandler.endWithError(e);
|
|
175
|
+
throw e;
|
|
176
|
+
}
|
|
132
177
|
}, callback);
|
|
133
178
|
}
|
|
134
179
|
/**
|
|
@@ -138,10 +183,20 @@ class CouchbaseList {
|
|
|
138
183
|
* @param callback A node-style callback to be invoked after execution.
|
|
139
184
|
*/
|
|
140
185
|
async push(value, callback) {
|
|
186
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.ListPush, this._coll.observabilityInstruments);
|
|
187
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
141
188
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
189
|
+
try {
|
|
190
|
+
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.arrayAppend('', value)], {
|
|
191
|
+
storeSemantics: generaltypes_1.StoreSemantics.Upsert,
|
|
192
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
193
|
+
});
|
|
194
|
+
obsReqHandler.end();
|
|
195
|
+
}
|
|
196
|
+
catch (e) {
|
|
197
|
+
obsReqHandler.endWithError(e);
|
|
198
|
+
throw e;
|
|
199
|
+
}
|
|
145
200
|
}, callback);
|
|
146
201
|
}
|
|
147
202
|
/**
|
|
@@ -151,10 +206,20 @@ class CouchbaseList {
|
|
|
151
206
|
* @param callback A node-style callback to be invoked after execution.
|
|
152
207
|
*/
|
|
153
208
|
async unshift(value, callback) {
|
|
209
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.ListUnshift, this._coll.observabilityInstruments);
|
|
210
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
154
211
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
212
|
+
try {
|
|
213
|
+
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.arrayPrepend('', value)], {
|
|
214
|
+
storeSemantics: generaltypes_1.StoreSemantics.Upsert,
|
|
215
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
216
|
+
});
|
|
217
|
+
obsReqHandler.end();
|
|
218
|
+
}
|
|
219
|
+
catch (e) {
|
|
220
|
+
obsReqHandler.endWithError(e);
|
|
221
|
+
throw e;
|
|
222
|
+
}
|
|
158
223
|
}, callback);
|
|
159
224
|
}
|
|
160
225
|
}
|
|
@@ -174,8 +239,8 @@ class CouchbaseMap {
|
|
|
174
239
|
this._coll = collection;
|
|
175
240
|
this._key = key;
|
|
176
241
|
}
|
|
177
|
-
async _get() {
|
|
178
|
-
const doc = await this._coll.get(this._key);
|
|
242
|
+
async _get(parentSpan) {
|
|
243
|
+
const doc = await this._coll.get(this._key, { parentSpan: parentSpan });
|
|
179
244
|
if (!(doc.content instanceof Object)) {
|
|
180
245
|
throw new errors_1.CouchbaseError('expected document of object type');
|
|
181
246
|
}
|
|
@@ -187,8 +252,18 @@ class CouchbaseMap {
|
|
|
187
252
|
* @param callback A node-style callback to be invoked after execution.
|
|
188
253
|
*/
|
|
189
254
|
async getAll(callback) {
|
|
255
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.MapGetAll, this._coll.observabilityInstruments);
|
|
256
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
190
257
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
191
|
-
|
|
258
|
+
try {
|
|
259
|
+
const res = await this._get(obsReqHandler.wrappedSpan);
|
|
260
|
+
obsReqHandler.end();
|
|
261
|
+
return res;
|
|
262
|
+
}
|
|
263
|
+
catch (e) {
|
|
264
|
+
obsReqHandler.endWithError(e);
|
|
265
|
+
throw e;
|
|
266
|
+
}
|
|
192
267
|
}, callback);
|
|
193
268
|
}
|
|
194
269
|
/**
|
|
@@ -238,10 +313,20 @@ class CouchbaseMap {
|
|
|
238
313
|
* @param callback A node-style callback to be invoked after execution.
|
|
239
314
|
*/
|
|
240
315
|
async set(item, value, callback) {
|
|
316
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.MapSet, this._coll.observabilityInstruments);
|
|
317
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
241
318
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
319
|
+
try {
|
|
320
|
+
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.upsert(item, value)], {
|
|
321
|
+
storeSemantics: generaltypes_1.StoreSemantics.Upsert,
|
|
322
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
323
|
+
});
|
|
324
|
+
obsReqHandler.end();
|
|
325
|
+
}
|
|
326
|
+
catch (e) {
|
|
327
|
+
obsReqHandler.endWithError(e);
|
|
328
|
+
throw e;
|
|
329
|
+
}
|
|
245
330
|
}, callback);
|
|
246
331
|
}
|
|
247
332
|
/**
|
|
@@ -251,13 +336,22 @@ class CouchbaseMap {
|
|
|
251
336
|
* @param callback A node-style callback to be invoked after execution.
|
|
252
337
|
*/
|
|
253
338
|
async get(item, callback) {
|
|
339
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.MapGet, this._coll.observabilityInstruments);
|
|
340
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
254
341
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
342
|
+
try {
|
|
343
|
+
const res = await this._coll.lookupIn(this._key, [sdspecs_1.LookupInSpec.get(item)], { parentSpan: obsReqHandler.wrappedSpan });
|
|
344
|
+
const itemRes = res.content[0];
|
|
345
|
+
if (itemRes.error) {
|
|
346
|
+
throw itemRes.error;
|
|
347
|
+
}
|
|
348
|
+
obsReqHandler.end();
|
|
349
|
+
return itemRes.value;
|
|
350
|
+
}
|
|
351
|
+
catch (e) {
|
|
352
|
+
obsReqHandler.endWithError(e);
|
|
353
|
+
throw e;
|
|
259
354
|
}
|
|
260
|
-
return itemRes.value;
|
|
261
355
|
}, callback);
|
|
262
356
|
}
|
|
263
357
|
/**
|
|
@@ -267,8 +361,19 @@ class CouchbaseMap {
|
|
|
267
361
|
* @param callback A node-style callback to be invoked after execution.
|
|
268
362
|
*/
|
|
269
363
|
async remove(item, callback) {
|
|
364
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.MapRemove, this._coll.observabilityInstruments);
|
|
365
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
270
366
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
271
|
-
|
|
367
|
+
try {
|
|
368
|
+
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.remove(item)], {
|
|
369
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
370
|
+
});
|
|
371
|
+
obsReqHandler.end();
|
|
372
|
+
}
|
|
373
|
+
catch (e) {
|
|
374
|
+
obsReqHandler.endWithError(e);
|
|
375
|
+
throw e;
|
|
376
|
+
}
|
|
272
377
|
}, callback);
|
|
273
378
|
}
|
|
274
379
|
/**
|
|
@@ -278,12 +383,19 @@ class CouchbaseMap {
|
|
|
278
383
|
* @param callback A node-style callback to be invoked after execution.
|
|
279
384
|
*/
|
|
280
385
|
async exists(item, callback) {
|
|
386
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.MapExists, this._coll.observabilityInstruments);
|
|
387
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
281
388
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
282
|
-
|
|
283
|
-
sdspecs_1.LookupInSpec.exists(item),
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
389
|
+
try {
|
|
390
|
+
const res = await this._coll.lookupIn(this._key, [sdspecs_1.LookupInSpec.exists(item)], { parentSpan: obsReqHandler.wrappedSpan });
|
|
391
|
+
const itemRes = res.content[0];
|
|
392
|
+
obsReqHandler.end();
|
|
393
|
+
return itemRes.value;
|
|
394
|
+
}
|
|
395
|
+
catch (e) {
|
|
396
|
+
obsReqHandler.endWithError(e);
|
|
397
|
+
throw e;
|
|
398
|
+
}
|
|
287
399
|
}, callback);
|
|
288
400
|
}
|
|
289
401
|
/**
|
|
@@ -292,9 +404,18 @@ class CouchbaseMap {
|
|
|
292
404
|
* @param callback A node-style callback to be invoked after execution.
|
|
293
405
|
*/
|
|
294
406
|
async keys(callback) {
|
|
407
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.MapKeys, this._coll.observabilityInstruments);
|
|
408
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
295
409
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
296
|
-
|
|
297
|
-
|
|
410
|
+
try {
|
|
411
|
+
const values = await this._get(obsReqHandler.wrappedSpan);
|
|
412
|
+
obsReqHandler.end();
|
|
413
|
+
return Object.keys(values);
|
|
414
|
+
}
|
|
415
|
+
catch (e) {
|
|
416
|
+
obsReqHandler.endWithError(e);
|
|
417
|
+
throw e;
|
|
418
|
+
}
|
|
298
419
|
}, callback);
|
|
299
420
|
}
|
|
300
421
|
/**
|
|
@@ -303,9 +424,18 @@ class CouchbaseMap {
|
|
|
303
424
|
* @param callback A node-style callback to be invoked after execution.
|
|
304
425
|
*/
|
|
305
426
|
async values(callback) {
|
|
427
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.MapValues, this._coll.observabilityInstruments);
|
|
428
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
306
429
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
307
|
-
|
|
308
|
-
|
|
430
|
+
try {
|
|
431
|
+
const values = await this._get(obsReqHandler.wrappedSpan);
|
|
432
|
+
obsReqHandler.end();
|
|
433
|
+
return Object.values(values);
|
|
434
|
+
}
|
|
435
|
+
catch (e) {
|
|
436
|
+
obsReqHandler.endWithError(e);
|
|
437
|
+
throw e;
|
|
438
|
+
}
|
|
309
439
|
}, callback);
|
|
310
440
|
}
|
|
311
441
|
/**
|
|
@@ -314,9 +444,18 @@ class CouchbaseMap {
|
|
|
314
444
|
* @param callback A node-style callback to be invoked after execution.
|
|
315
445
|
*/
|
|
316
446
|
async size(callback) {
|
|
447
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.MapSize, this._coll.observabilityInstruments);
|
|
448
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
317
449
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
318
|
-
|
|
319
|
-
|
|
450
|
+
try {
|
|
451
|
+
const res = await this._coll.lookupIn(this._key, [sdspecs_1.LookupInSpec.count('')], { parentSpan: obsReqHandler.wrappedSpan });
|
|
452
|
+
obsReqHandler.end();
|
|
453
|
+
return res.content[0].value;
|
|
454
|
+
}
|
|
455
|
+
catch (e) {
|
|
456
|
+
obsReqHandler.endWithError(e);
|
|
457
|
+
throw e;
|
|
458
|
+
}
|
|
320
459
|
}, callback);
|
|
321
460
|
}
|
|
322
461
|
}
|
|
@@ -349,9 +488,18 @@ class CouchbaseQueue {
|
|
|
349
488
|
* @param callback A node-style callback to be invoked after execution.
|
|
350
489
|
*/
|
|
351
490
|
async size(callback) {
|
|
491
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.QueueSize, this._coll.observabilityInstruments);
|
|
492
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
352
493
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
353
|
-
|
|
354
|
-
|
|
494
|
+
try {
|
|
495
|
+
const res = await this._coll.lookupIn(this._key, [sdspecs_1.LookupInSpec.count('')], { parentSpan: obsReqHandler.wrappedSpan });
|
|
496
|
+
obsReqHandler.end();
|
|
497
|
+
return res.content[0].value;
|
|
498
|
+
}
|
|
499
|
+
catch (e) {
|
|
500
|
+
obsReqHandler.endWithError(e);
|
|
501
|
+
throw e;
|
|
502
|
+
}
|
|
355
503
|
}, callback);
|
|
356
504
|
}
|
|
357
505
|
/**
|
|
@@ -361,10 +509,20 @@ class CouchbaseQueue {
|
|
|
361
509
|
* @param callback A node-style callback to be invoked after execution.
|
|
362
510
|
*/
|
|
363
511
|
async push(value, callback) {
|
|
512
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.QueuePush, this._coll.observabilityInstruments);
|
|
513
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
364
514
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
515
|
+
try {
|
|
516
|
+
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.arrayPrepend('', value)], {
|
|
517
|
+
storeSemantics: generaltypes_1.StoreSemantics.Upsert,
|
|
518
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
519
|
+
});
|
|
520
|
+
obsReqHandler.end();
|
|
521
|
+
}
|
|
522
|
+
catch (e) {
|
|
523
|
+
obsReqHandler.endWithError(e);
|
|
524
|
+
throw e;
|
|
525
|
+
}
|
|
368
526
|
}, callback);
|
|
369
527
|
}
|
|
370
528
|
/**
|
|
@@ -373,26 +531,34 @@ class CouchbaseQueue {
|
|
|
373
531
|
* @param callback A node-style callback to be invoked after execution.
|
|
374
532
|
*/
|
|
375
533
|
async pop(callback) {
|
|
534
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.QueuePop, this._coll.observabilityInstruments);
|
|
535
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
376
536
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
sdspecs_1.LookupInSpec.get('[-1]'),
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
537
|
+
try {
|
|
538
|
+
for (let i = 0; i < 16; ++i) {
|
|
539
|
+
try {
|
|
540
|
+
const res = await this._coll.lookupIn(this._key, [sdspecs_1.LookupInSpec.get('[-1]')], { parentSpan: obsReqHandler.wrappedSpan });
|
|
541
|
+
const value = res.content[0].value;
|
|
542
|
+
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.remove('[-1]')], {
|
|
543
|
+
cas: res.cas,
|
|
544
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
545
|
+
});
|
|
546
|
+
obsReqHandler.end();
|
|
547
|
+
return value;
|
|
548
|
+
}
|
|
549
|
+
catch (e) {
|
|
550
|
+
if (e instanceof errors_1.PathInvalidError) {
|
|
551
|
+
throw new errors_1.CouchbaseError('no items available in list');
|
|
552
|
+
}
|
|
553
|
+
// continue and retry
|
|
391
554
|
}
|
|
392
|
-
// continue and retry
|
|
393
555
|
}
|
|
556
|
+
throw new errors_1.CouchbaseError('no items available to pop');
|
|
557
|
+
}
|
|
558
|
+
catch (e) {
|
|
559
|
+
obsReqHandler.endWithError(e);
|
|
560
|
+
throw e;
|
|
394
561
|
}
|
|
395
|
-
throw new errors_1.CouchbaseError('no items available to pop');
|
|
396
562
|
}, callback);
|
|
397
563
|
}
|
|
398
564
|
}
|
|
@@ -412,8 +578,8 @@ class CouchbaseSet {
|
|
|
412
578
|
this._coll = collection;
|
|
413
579
|
this._key = key;
|
|
414
580
|
}
|
|
415
|
-
async _get() {
|
|
416
|
-
const doc = await this._coll.get(this._key);
|
|
581
|
+
async _get(parentSpan) {
|
|
582
|
+
const doc = await this._coll.get(this._key, { parentSpan: parentSpan });
|
|
417
583
|
if (!(doc.content instanceof Array)) {
|
|
418
584
|
throw new errors_1.CouchbaseError('expected document of array type');
|
|
419
585
|
}
|
|
@@ -427,18 +593,24 @@ class CouchbaseSet {
|
|
|
427
593
|
* @param callback A node-style callback to be invoked after execution.
|
|
428
594
|
*/
|
|
429
595
|
async add(item, callback) {
|
|
596
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.SetAdd, this._coll.observabilityInstruments);
|
|
597
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
430
598
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
431
599
|
try {
|
|
432
600
|
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.arrayAddUnique('', item)], {
|
|
433
601
|
storeSemantics: generaltypes_1.StoreSemantics.Upsert,
|
|
602
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
434
603
|
});
|
|
435
604
|
}
|
|
436
605
|
catch (e) {
|
|
437
606
|
if (e instanceof errors_1.PathExistsError) {
|
|
607
|
+
obsReqHandler.end();
|
|
438
608
|
return false;
|
|
439
609
|
}
|
|
610
|
+
obsReqHandler.endWithError(e);
|
|
440
611
|
throw e;
|
|
441
612
|
}
|
|
613
|
+
obsReqHandler.end();
|
|
442
614
|
return true;
|
|
443
615
|
}, callback);
|
|
444
616
|
}
|
|
@@ -449,14 +621,24 @@ class CouchbaseSet {
|
|
|
449
621
|
* @param callback A node-style callback to be invoked after execution.
|
|
450
622
|
*/
|
|
451
623
|
async contains(item, callback) {
|
|
624
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.SetContains, this._coll.observabilityInstruments);
|
|
625
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
452
626
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
627
|
+
try {
|
|
628
|
+
const values = await this._get(obsReqHandler.wrappedSpan);
|
|
629
|
+
for (let i = 0; i < values.length; ++i) {
|
|
630
|
+
if (values[i] === item) {
|
|
631
|
+
obsReqHandler.end();
|
|
632
|
+
return true;
|
|
633
|
+
}
|
|
457
634
|
}
|
|
635
|
+
obsReqHandler.end();
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
catch (e) {
|
|
639
|
+
obsReqHandler.endWithError(e);
|
|
640
|
+
throw e;
|
|
458
641
|
}
|
|
459
|
-
return false;
|
|
460
642
|
}, callback);
|
|
461
643
|
}
|
|
462
644
|
/**
|
|
@@ -466,27 +648,39 @@ class CouchbaseSet {
|
|
|
466
648
|
* @param callback A node-style callback to be invoked after execution.
|
|
467
649
|
*/
|
|
468
650
|
async remove(item, callback) {
|
|
651
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.SetRemove, this._coll.observabilityInstruments);
|
|
652
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
469
653
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
654
|
+
try {
|
|
655
|
+
for (let i = 0; i < 16; ++i) {
|
|
656
|
+
try {
|
|
657
|
+
const res = await this._coll.get(this._key, {
|
|
658
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
659
|
+
});
|
|
660
|
+
if (!(res.content instanceof Array)) {
|
|
661
|
+
throw new errors_1.CouchbaseError('expected document of array type');
|
|
662
|
+
}
|
|
663
|
+
const itemIdx = res.content.indexOf(item);
|
|
664
|
+
if (itemIdx === -1) {
|
|
665
|
+
throw new Error('item was not found in set');
|
|
666
|
+
}
|
|
667
|
+
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.remove('[' + itemIdx + ']')], {
|
|
668
|
+
cas: res.cas,
|
|
669
|
+
parentSpan: obsReqHandler.wrappedSpan,
|
|
670
|
+
});
|
|
671
|
+
obsReqHandler.end();
|
|
672
|
+
return;
|
|
475
673
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
throw new Error('item was not found in set');
|
|
674
|
+
catch (_e) {
|
|
675
|
+
// continue and retry
|
|
479
676
|
}
|
|
480
|
-
await this._coll.mutateIn(this._key, [sdspecs_1.MutateInSpec.remove('[' + itemIdx + ']')], {
|
|
481
|
-
cas: res.cas,
|
|
482
|
-
});
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
catch (e) {
|
|
486
|
-
// continue and retry
|
|
487
677
|
}
|
|
678
|
+
throw new errors_1.CouchbaseError('no items available to pop');
|
|
679
|
+
}
|
|
680
|
+
catch (e) {
|
|
681
|
+
obsReqHandler.endWithError(e);
|
|
682
|
+
throw e;
|
|
488
683
|
}
|
|
489
|
-
throw new errors_1.CouchbaseError('no items available to pop');
|
|
490
684
|
}, callback);
|
|
491
685
|
}
|
|
492
686
|
/**
|
|
@@ -495,8 +689,18 @@ class CouchbaseSet {
|
|
|
495
689
|
* @param callback A node-style callback to be invoked after execution.
|
|
496
690
|
*/
|
|
497
691
|
async values(callback) {
|
|
692
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.SetValues, this._coll.observabilityInstruments);
|
|
693
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
498
694
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
499
|
-
|
|
695
|
+
try {
|
|
696
|
+
const res = await this._get(obsReqHandler.wrappedSpan);
|
|
697
|
+
obsReqHandler.end();
|
|
698
|
+
return res;
|
|
699
|
+
}
|
|
700
|
+
catch (e) {
|
|
701
|
+
obsReqHandler.endWithError(e);
|
|
702
|
+
throw e;
|
|
703
|
+
}
|
|
500
704
|
}, callback);
|
|
501
705
|
}
|
|
502
706
|
/**
|
|
@@ -505,9 +709,18 @@ class CouchbaseSet {
|
|
|
505
709
|
* @param callback A node-style callback to be invoked after execution.
|
|
506
710
|
*/
|
|
507
711
|
async size(callback) {
|
|
712
|
+
const obsReqHandler = new observabilityhandler_1.ObservableRequestHandler(observabilitytypes_1.DatastructureOp.SetSize, this._coll.observabilityInstruments);
|
|
713
|
+
obsReqHandler.setRequestKeyValueAttributes(this._coll._cppDocId(this._key));
|
|
508
714
|
return utilities_1.PromiseHelper.wrapAsync(async () => {
|
|
509
|
-
|
|
510
|
-
|
|
715
|
+
try {
|
|
716
|
+
const res = await this._coll.lookupIn(this._key, [sdspecs_1.LookupInSpec.count('')], { parentSpan: obsReqHandler.wrappedSpan });
|
|
717
|
+
obsReqHandler.end();
|
|
718
|
+
return res.content[0].value;
|
|
719
|
+
}
|
|
720
|
+
catch (e) {
|
|
721
|
+
obsReqHandler.endWithError(e);
|
|
722
|
+
throw e;
|
|
723
|
+
}
|
|
511
724
|
}, callback);
|
|
512
725
|
}
|
|
513
726
|
}
|
|
@@ -68,7 +68,7 @@ class PingExecutor {
|
|
|
68
68
|
async ping(options) {
|
|
69
69
|
return new Promise((resolve, reject) => {
|
|
70
70
|
// BUG(JSCBC-993): timeout is not currently sent to the C++ client
|
|
71
|
-
options.timeout;
|
|
71
|
+
void options.timeout;
|
|
72
72
|
this._cluster.conn.ping({
|
|
73
73
|
report_id: options.reportId,
|
|
74
74
|
services: options.serviceTypes
|
package/dist/errors.d.ts
CHANGED
|
@@ -744,3 +744,11 @@ export declare class TransactionExpiredError extends CouchbaseError {
|
|
|
744
744
|
export declare class TransactionCommitAmbiguousError extends CouchbaseError {
|
|
745
745
|
constructor(cause?: Error);
|
|
746
746
|
}
|
|
747
|
+
/**
|
|
748
|
+
* Indicates an error occurred during a observability metric operation.
|
|
749
|
+
*
|
|
750
|
+
* @category Error Handling
|
|
751
|
+
*/
|
|
752
|
+
export declare class MeterError extends CouchbaseError {
|
|
753
|
+
constructor(cause?: Error);
|
|
754
|
+
}
|