/*- * Copyright (c) 2018, 2026 Oracle and/or its affiliates. All rights reserved. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl/ */ import type { NoSQLClient } from "../nosql_client"; import type { Operation } from "../param"; import type { Config } from "../config"; import type { IAMConfig } from "./iam/types"; import type { IAMAuthorizationProvider } from "./iam/auth_provider"; import type { KVStoreAuthConfig } from "./kvstore/types"; import type { KVStoreAuthorizationProvider } from "./kvstore/auth_provider"; import type { ServiceType } from "../constants"; /** * Authorization configuration for the driver provided as {@link Config#auth} * when {@link NoSQLClient} instance is created. *
* Every request to the server made by {@link NoSQLClient} methods requires * authorization information. The way authorization information is obtained * depends on the {@link ServiceType} used (set as * {@link Config#serviceType}): *
* If using non-secure store, authorization is not required and you do not * need to specify {@link Config#auth} property.
* Note that you must specify only one of {@link AuthConfig#iam}, * {@link AuthConfig#kvstore} or {@link AuthConfig#provider} properties. */ export interface AuthConfig { /** * IAM configuration, see {@link IAMConfig}. Must be set to use Oracle * NoSQL Cloud service. * @see {@link IAMConfig} */ iam?: IAMConfig; /** * Configuration to authenticate with secure On-Premise NoSQL database. * Must be set to connect to secure store. * @see {@link KVStoreAuthConfig} */ kvstore?: KVStoreAuthConfig; /** * Custom authorization provider. * @see {@link AuthorizationProvider} */ provider?: AuthorizationProvider | AuthorizationProvider['getAuthorization']; } /** * Represents the authorization information obtained by * {@link AuthorizationProvider#getAuthorization} method. This information * may be returned as either a string or an object: *
* This method only needs to be implemented if the provider needs to * release resources such as connections, open files, etc. when the * instance of {@link NoSQLClient} is no longer needed. *
* After this provider instance is passed to {@link NoSQLClient} via * {@link AuthConfig}, the driver will invoke this method when * calling {@link NoSQLClient#close} method of {@link NoSQLClient}, so * applications should not call this method (unless this provider is * used standalone). *
* This method can be either sync or async depending on the resources * that need to be released. If a Promise is returned, it can * be awaited when calling {@link NoSQLClient#close} method of * {@link NoSQLClient}. *
* Implementations of this method should not throw errors or result in
* promise rejections (rather, any errors should be handled within the
* implementation).
*/
close?(): void | Promise