@influxdata/influxdb3-client 2.2.0-nightly.16311 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -94,6 +94,11 @@ interface CommunicationObserver<T> {
94
94
  useResume?: (resume: () => void) => void;
95
95
  }
96
96
 
97
+ interface PartialWriteLineError {
98
+ lineNumber: number;
99
+ errorMessage: string;
100
+ originalLine: string;
101
+ }
97
102
  /** IllegalArgumentError is thrown when illegal argument is supplied. */
98
103
  declare class IllegalArgumentError extends Error {
99
104
  constructor(message: string);
@@ -113,6 +118,11 @@ declare class HttpError extends Error {
113
118
  json: any;
114
119
  constructor(statusCode: number, statusMessage: string | undefined, body?: string | undefined, contentType?: string | undefined | null, headers?: (HttpHeaders | null) | undefined, message?: string);
115
120
  }
121
+ declare class PartialWriteError extends HttpError {
122
+ readonly lineErrors: PartialWriteLineError[];
123
+ constructor(statusCode: number, statusMessage: string | undefined, body: string | undefined, contentType: string | undefined | null, headers: HttpHeaders | null | undefined, message: string, lineErrors: PartialWriteLineError[]);
124
+ static fromHttpError(error: HttpError): PartialWriteError | undefined;
125
+ }
116
126
  /** RequestTimedOutError indicates request timeout in the communication with the server */
117
127
  declare class RequestTimedOutError extends Error {
118
128
  constructor();
@@ -839,12 +849,29 @@ interface WriteOptions {
839
849
  * noSync=true means faster write but without the confirmation that the data was persisted.
840
850
  *
841
851
  * Note: This option is supported by InfluxDB 3 Core and Enterprise servers only.
842
- * For other InfluxDB 3 server types (InfluxDB Clustered, InfluxDB Clould Serverless/Dedicated)
852
+ * For other InfluxDB 3 server types (InfluxDB Clustered, InfluxDB Cloud Dedicated/Serverless)
843
853
  * the write operation will fail with an error.
844
854
  *
845
855
  * Default value: false.
846
856
  */
847
857
  noSync?: boolean;
858
+ /**
859
+ * Controls partial-write behavior for writes sent to the V3 API endpoint
860
+ * (useV2Api=false).
861
+ * The client sends accept_partial=false only when set to false.
862
+ *
863
+ * For writes sent to the V2 API endpoint (useV2Api=true), this option is not used.
864
+ * Default value: true.
865
+ */
866
+ acceptPartial?: boolean;
867
+ /**
868
+ * Forces writes to the V2 API endpoint.
869
+ * Use this for InfluxDB Clustered and InfluxDB Cloud Dedicated/Serverless.
870
+ * For InfluxDB 3 Core/Enterprise, set useV2Api=false to write through the V3 API endpoint.
871
+ *
872
+ * Default value: true.
873
+ */
874
+ useV2Api?: boolean;
848
875
  /** default tags
849
876
  *
850
877
  * @example Default tags using client config
@@ -1038,9 +1065,26 @@ declare const convertTime: (value: string | number | Date | undefined, precision
1038
1065
  * - `string`: Represents lines of the [Line Protocol](https://bit.ly/2QL99fu).
1039
1066
  */
1040
1067
  type WritableData = ArrayLike<string> | ArrayLike<Point> | string | Point;
1068
+ /**
1069
+ * Convert `WritableData` to an array of lines of
1070
+ * [Line Protocol](https://bit.ly/2QL99fu)).
1071
+ * If the data is an array of `Point` objects, it will be converted to lines of
1072
+ * Line Protocol. If the data is a single `Point` object, it will be converted
1073
+ * to a single line of Line Protocol. If the data is an array of lines of
1074
+ * Line Protocol, it will be returned as is.
1075
+ *
1076
+ * @param data - data to write
1077
+ * @param defaultTags - the default tags to apply to all points.
1078
+ * @param tagOrder - preferred order of tags in line protocol serialization.
1079
+ * Tags listed here are written first, in the same order.
1080
+ * The remaining tags are appended in lexicographical order.
1081
+ * This helps control first-write column order in InfluxDB 3.
1082
+ * @param precision - the writing precision. It is used as the time precision
1083
+ * when serializing Point instances whose timestamp is a Date
1084
+ */
1041
1085
  declare const writableDataToLineProtocol: (data: WritableData, defaultTags?: {
1042
1086
  [key: string]: string;
1043
- }, tagOrder?: string[]) => string[];
1087
+ }, tagOrder?: string[], precision?: WritePrecision) => string[];
1044
1088
 
1045
1089
  declare const collectAll: <T>(generator: AsyncGenerator<T, any, any>) => Promise<T[]>;
1046
1090
  /**
@@ -1075,7 +1119,9 @@ declare class InfluxDBClient {
1075
1119
  * - timeout - I/O timeout
1076
1120
  * - precision - timestamp precision when writing data
1077
1121
  * - gzipThreshold - payload size threshold for gzipping data
1122
+ * - writeAcceptPartial - allow partial writes when some lines fail
1078
1123
  * - writeNoSync - skip waiting for WAL persistence on write
1124
+ * - writeUseV2Api - use /api/v2/write V2 API endpoint
1079
1125
  *
1080
1126
  * @param connectionString - connection string
1081
1127
  */
@@ -1091,7 +1137,9 @@ declare class InfluxDBClient {
1091
1137
  * - INFLUX_DATABASE - database (bucket) name
1092
1138
  * - INFLUX_PRECISION - timestamp precision when writing data
1093
1139
  * - INFLUX_GZIP_THRESHOLD - payload size threshold for gzipping data
1140
+ * - INFLUX_WRITE_ACCEPT_PARTIAL - allow partial writes when some lines fail
1094
1141
  * - INFLUX_WRITE_NO_SYNC - skip waiting for WAL persistence on write
1142
+ * - INFLUX_WRITE_USE_V2_API - use /api/v2/write V2 API endpoint
1095
1143
  * - INFLUX_GRPC_OPTIONS - comma separated set of key=value pairs matching @grpc/grpc-js channel options.
1096
1144
  */
1097
1145
  constructor();
@@ -1099,6 +1147,12 @@ declare class InfluxDBClient {
1099
1147
  private _mergeQueryOptions;
1100
1148
  /**
1101
1149
  * Write data into specified database.
1150
+ *
1151
+ * Warning: If only one Point is provided, and that Point
1152
+ * contains fields with null/undefined values, those fields will not be written to InfluxDB.
1153
+ * If such fields are later queried explicitly, for example,
1154
+ * `SELECT field_with_value, field_with_null_value FROM my_table` an error will be thrown.
1155
+ *
1102
1156
  * @param data - data to write
1103
1157
  * @param database - database to write into
1104
1158
  * @param org - organization to write into
@@ -1156,4 +1210,4 @@ declare class InfluxDBClient {
1156
1210
  close(): Promise<void>;
1157
1211
  }
1158
1212
 
1159
- export { AbortError, type Cancellable, type ChunkCombiner, type ClientOptions, type CommunicationObserver, type ConnectionOptions, DEFAULT_ConnectionOptions, DEFAULT_QueryOptions, DEFAULT_WriteOptions, GetFieldTypeMissmatchError, type HttpHeaders as Headers, HttpError, type HttpHeaders, IllegalArgumentError, InfluxDBClient, Log, type Logger, Point, type PointFieldType, PointValues, type QParamType, type QueryOptions, type QueryType, RequestTimedOutError, type ResponseStartedFn, type SendOptions, type TimeConverter, type Transport, type WritableData, type WriteOptions, type WritePrecision, collectAll, consoleLogger, convertTime, convertTimeToNanos, createTextDecoderCombiner, currentTime, dateToProtocolTimestamp, escape, fromConnectionString, fromEnv, isNumber, parsePrecision, precisionToV2ApiString, precisionToV3ApiString, setLogger, useProcessHrtime, writableDataToLineProtocol };
1213
+ export { AbortError, type Cancellable, type ChunkCombiner, type ClientOptions, type CommunicationObserver, type ConnectionOptions, DEFAULT_ConnectionOptions, DEFAULT_QueryOptions, DEFAULT_WriteOptions, GetFieldTypeMissmatchError, type HttpHeaders as Headers, HttpError, type HttpHeaders, IllegalArgumentError, InfluxDBClient, Log, type Logger, PartialWriteError, type PartialWriteLineError, Point, type PointFieldType, PointValues, type QParamType, type QueryOptions, type QueryType, RequestTimedOutError, type ResponseStartedFn, type SendOptions, type TimeConverter, type Transport, type WritableData, type WriteOptions, type WritePrecision, collectAll, consoleLogger, convertTime, convertTimeToNanos, createTextDecoderCombiner, currentTime, dateToProtocolTimestamp, escape, fromConnectionString, fromEnv, isNumber, parsePrecision, precisionToV2ApiString, precisionToV3ApiString, setLogger, useProcessHrtime, writableDataToLineProtocol };
package/dist/index.d.ts CHANGED
@@ -94,6 +94,11 @@ interface CommunicationObserver<T> {
94
94
  useResume?: (resume: () => void) => void;
95
95
  }
96
96
 
97
+ interface PartialWriteLineError {
98
+ lineNumber: number;
99
+ errorMessage: string;
100
+ originalLine: string;
101
+ }
97
102
  /** IllegalArgumentError is thrown when illegal argument is supplied. */
98
103
  declare class IllegalArgumentError extends Error {
99
104
  constructor(message: string);
@@ -113,6 +118,11 @@ declare class HttpError extends Error {
113
118
  json: any;
114
119
  constructor(statusCode: number, statusMessage: string | undefined, body?: string | undefined, contentType?: string | undefined | null, headers?: (HttpHeaders | null) | undefined, message?: string);
115
120
  }
121
+ declare class PartialWriteError extends HttpError {
122
+ readonly lineErrors: PartialWriteLineError[];
123
+ constructor(statusCode: number, statusMessage: string | undefined, body: string | undefined, contentType: string | undefined | null, headers: HttpHeaders | null | undefined, message: string, lineErrors: PartialWriteLineError[]);
124
+ static fromHttpError(error: HttpError): PartialWriteError | undefined;
125
+ }
116
126
  /** RequestTimedOutError indicates request timeout in the communication with the server */
117
127
  declare class RequestTimedOutError extends Error {
118
128
  constructor();
@@ -839,12 +849,29 @@ interface WriteOptions {
839
849
  * noSync=true means faster write but without the confirmation that the data was persisted.
840
850
  *
841
851
  * Note: This option is supported by InfluxDB 3 Core and Enterprise servers only.
842
- * For other InfluxDB 3 server types (InfluxDB Clustered, InfluxDB Clould Serverless/Dedicated)
852
+ * For other InfluxDB 3 server types (InfluxDB Clustered, InfluxDB Cloud Dedicated/Serverless)
843
853
  * the write operation will fail with an error.
844
854
  *
845
855
  * Default value: false.
846
856
  */
847
857
  noSync?: boolean;
858
+ /**
859
+ * Controls partial-write behavior for writes sent to the V3 API endpoint
860
+ * (useV2Api=false).
861
+ * The client sends accept_partial=false only when set to false.
862
+ *
863
+ * For writes sent to the V2 API endpoint (useV2Api=true), this option is not used.
864
+ * Default value: true.
865
+ */
866
+ acceptPartial?: boolean;
867
+ /**
868
+ * Forces writes to the V2 API endpoint.
869
+ * Use this for InfluxDB Clustered and InfluxDB Cloud Dedicated/Serverless.
870
+ * For InfluxDB 3 Core/Enterprise, set useV2Api=false to write through the V3 API endpoint.
871
+ *
872
+ * Default value: true.
873
+ */
874
+ useV2Api?: boolean;
848
875
  /** default tags
849
876
  *
850
877
  * @example Default tags using client config
@@ -1038,9 +1065,26 @@ declare const convertTime: (value: string | number | Date | undefined, precision
1038
1065
  * - `string`: Represents lines of the [Line Protocol](https://bit.ly/2QL99fu).
1039
1066
  */
1040
1067
  type WritableData = ArrayLike<string> | ArrayLike<Point> | string | Point;
1068
+ /**
1069
+ * Convert `WritableData` to an array of lines of
1070
+ * [Line Protocol](https://bit.ly/2QL99fu)).
1071
+ * If the data is an array of `Point` objects, it will be converted to lines of
1072
+ * Line Protocol. If the data is a single `Point` object, it will be converted
1073
+ * to a single line of Line Protocol. If the data is an array of lines of
1074
+ * Line Protocol, it will be returned as is.
1075
+ *
1076
+ * @param data - data to write
1077
+ * @param defaultTags - the default tags to apply to all points.
1078
+ * @param tagOrder - preferred order of tags in line protocol serialization.
1079
+ * Tags listed here are written first, in the same order.
1080
+ * The remaining tags are appended in lexicographical order.
1081
+ * This helps control first-write column order in InfluxDB 3.
1082
+ * @param precision - the writing precision. It is used as the time precision
1083
+ * when serializing Point instances whose timestamp is a Date
1084
+ */
1041
1085
  declare const writableDataToLineProtocol: (data: WritableData, defaultTags?: {
1042
1086
  [key: string]: string;
1043
- }, tagOrder?: string[]) => string[];
1087
+ }, tagOrder?: string[], precision?: WritePrecision) => string[];
1044
1088
 
1045
1089
  declare const collectAll: <T>(generator: AsyncGenerator<T, any, any>) => Promise<T[]>;
1046
1090
  /**
@@ -1075,7 +1119,9 @@ declare class InfluxDBClient {
1075
1119
  * - timeout - I/O timeout
1076
1120
  * - precision - timestamp precision when writing data
1077
1121
  * - gzipThreshold - payload size threshold for gzipping data
1122
+ * - writeAcceptPartial - allow partial writes when some lines fail
1078
1123
  * - writeNoSync - skip waiting for WAL persistence on write
1124
+ * - writeUseV2Api - use /api/v2/write V2 API endpoint
1079
1125
  *
1080
1126
  * @param connectionString - connection string
1081
1127
  */
@@ -1091,7 +1137,9 @@ declare class InfluxDBClient {
1091
1137
  * - INFLUX_DATABASE - database (bucket) name
1092
1138
  * - INFLUX_PRECISION - timestamp precision when writing data
1093
1139
  * - INFLUX_GZIP_THRESHOLD - payload size threshold for gzipping data
1140
+ * - INFLUX_WRITE_ACCEPT_PARTIAL - allow partial writes when some lines fail
1094
1141
  * - INFLUX_WRITE_NO_SYNC - skip waiting for WAL persistence on write
1142
+ * - INFLUX_WRITE_USE_V2_API - use /api/v2/write V2 API endpoint
1095
1143
  * - INFLUX_GRPC_OPTIONS - comma separated set of key=value pairs matching @grpc/grpc-js channel options.
1096
1144
  */
1097
1145
  constructor();
@@ -1099,6 +1147,12 @@ declare class InfluxDBClient {
1099
1147
  private _mergeQueryOptions;
1100
1148
  /**
1101
1149
  * Write data into specified database.
1150
+ *
1151
+ * Warning: If only one Point is provided, and that Point
1152
+ * contains fields with null/undefined values, those fields will not be written to InfluxDB.
1153
+ * If such fields are later queried explicitly, for example,
1154
+ * `SELECT field_with_value, field_with_null_value FROM my_table` an error will be thrown.
1155
+ *
1102
1156
  * @param data - data to write
1103
1157
  * @param database - database to write into
1104
1158
  * @param org - organization to write into
@@ -1156,4 +1210,4 @@ declare class InfluxDBClient {
1156
1210
  close(): Promise<void>;
1157
1211
  }
1158
1212
 
1159
- export { AbortError, type Cancellable, type ChunkCombiner, type ClientOptions, type CommunicationObserver, type ConnectionOptions, DEFAULT_ConnectionOptions, DEFAULT_QueryOptions, DEFAULT_WriteOptions, GetFieldTypeMissmatchError, type HttpHeaders as Headers, HttpError, type HttpHeaders, IllegalArgumentError, InfluxDBClient, Log, type Logger, Point, type PointFieldType, PointValues, type QParamType, type QueryOptions, type QueryType, RequestTimedOutError, type ResponseStartedFn, type SendOptions, type TimeConverter, type Transport, type WritableData, type WriteOptions, type WritePrecision, collectAll, consoleLogger, convertTime, convertTimeToNanos, createTextDecoderCombiner, currentTime, dateToProtocolTimestamp, escape, fromConnectionString, fromEnv, isNumber, parsePrecision, precisionToV2ApiString, precisionToV3ApiString, setLogger, useProcessHrtime, writableDataToLineProtocol };
1213
+ export { AbortError, type Cancellable, type ChunkCombiner, type ClientOptions, type CommunicationObserver, type ConnectionOptions, DEFAULT_ConnectionOptions, DEFAULT_QueryOptions, DEFAULT_WriteOptions, GetFieldTypeMissmatchError, type HttpHeaders as Headers, HttpError, type HttpHeaders, IllegalArgumentError, InfluxDBClient, Log, type Logger, PartialWriteError, type PartialWriteLineError, Point, type PointFieldType, PointValues, type QParamType, type QueryOptions, type QueryType, RequestTimedOutError, type ResponseStartedFn, type SendOptions, type TimeConverter, type Transport, type WritableData, type WriteOptions, type WritePrecision, collectAll, consoleLogger, convertTime, convertTimeToNanos, createTextDecoderCombiner, currentTime, dateToProtocolTimestamp, escape, fromConnectionString, fromEnv, isNumber, parsePrecision, precisionToV2ApiString, precisionToV3ApiString, setLogger, useProcessHrtime, writableDataToLineProtocol };