azure-kusto-ingest 2.2.3 → 3.2.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/.eslintignore +5 -0
- package/.eslintrc.js +247 -0
- package/.mocharc.json +2 -2
- package/.prettierignore +8 -0
- package/.prettierrc.json +5 -0
- package/README.md +64 -62
- package/example.js +20 -30
- package/index.d.ts +24 -2
- package/index.js +46 -6
- package/index.js.map +1 -1
- package/package.json +70 -55
- package/source/abstractKustoClient.d.ts +8 -7
- package/source/abstractKustoClient.js +20 -16
- package/source/abstractKustoClient.js.map +1 -1
- package/source/columnMappings.d.ts +114 -0
- package/source/columnMappings.js +241 -0
- package/source/columnMappings.js.map +1 -0
- package/source/descriptors.d.ts +4 -3
- package/source/descriptors.js +16 -6
- package/source/descriptors.js.map +1 -1
- package/source/errors.d.ts +3 -0
- package/source/errors.js +13 -0
- package/source/errors.js.map +1 -0
- package/source/ingestClient.d.ts +6 -7
- package/source/ingestClient.js +10 -14
- package/source/ingestClient.js.map +1 -1
- package/source/ingestionBlobInfo.js +12 -9
- package/source/ingestionBlobInfo.js.map +1 -1
- package/source/ingestionProperties.d.ts +104 -40
- package/source/ingestionProperties.js +180 -84
- package/source/ingestionProperties.js.map +1 -1
- package/source/managedStreamingIngestClient.d.ts +36 -0
- package/source/managedStreamingIngestClient.js +107 -0
- package/source/managedStreamingIngestClient.js.map +1 -0
- package/source/resourceManager.d.ts +1 -1
- package/source/resourceManager.js +14 -16
- package/source/resourceManager.js.map +1 -1
- package/source/retry.d.ts +10 -0
- package/source/retry.js +44 -0
- package/source/retry.js.map +1 -0
- package/source/status.js +6 -17
- package/source/status.js.map +1 -1
- package/source/statusQ.js +7 -6
- package/source/statusQ.js.map +1 -1
- package/source/streamUtils.d.ts +6 -0
- package/source/streamUtils.js +61 -0
- package/source/streamUtils.js.map +1 -0
- package/source/streamingIngestClient.d.ts +5 -6
- package/source/streamingIngestClient.js +8 -19
- package/source/streamingIngestClient.js.map +1 -1
- package/tsconfig.json +16 -16
- package/tsconfig.tsbuildinfo +1 -1
- package/index.ts +0 -48
- package/tslint.json +0 -18
|
@@ -1,24 +1,88 @@
|
|
|
1
|
+
import { ColumnMapping } from "./columnMappings";
|
|
2
|
+
/**
|
|
3
|
+
* Data formats supported for Kusto ingestion.
|
|
4
|
+
*/
|
|
1
5
|
export declare enum DataFormat {
|
|
6
|
+
/**
|
|
7
|
+
* Comma-separated value.
|
|
8
|
+
*/
|
|
2
9
|
CSV = "csv",
|
|
10
|
+
/**
|
|
11
|
+
* Tab-separated value.
|
|
12
|
+
*/
|
|
3
13
|
TSV = "tsv",
|
|
14
|
+
/**
|
|
15
|
+
* Semicolon-separated value (the unique Azure Storage log format).
|
|
16
|
+
*/
|
|
4
17
|
SCSV = "scsv",
|
|
18
|
+
/**
|
|
19
|
+
* Start-Of-Header (CTRL-A)-separated value.
|
|
20
|
+
*/
|
|
5
21
|
SOHSV = "sohsv",
|
|
22
|
+
/**
|
|
23
|
+
* Pipeline-separated value (used by Cosmos).
|
|
24
|
+
*/
|
|
6
25
|
PSV = "psv",
|
|
26
|
+
/**
|
|
27
|
+
* Each record is a line and has just one field.
|
|
28
|
+
*/
|
|
7
29
|
TXT = "txt",
|
|
30
|
+
/**
|
|
31
|
+
* Whole stream is a single record with a single field.
|
|
32
|
+
*/
|
|
33
|
+
RAW = "raw",
|
|
34
|
+
/**
|
|
35
|
+
* Tab-separated value with '\' escaping character.
|
|
36
|
+
*/
|
|
37
|
+
TSVE = "tsve",
|
|
38
|
+
/**
|
|
39
|
+
* Data is in a JSON format, each line is record with a single JSON value.
|
|
40
|
+
*/
|
|
8
41
|
JSON = "json",
|
|
42
|
+
/**
|
|
43
|
+
* Data stream holds a single JSON value -- newlines are regular whitespace.
|
|
44
|
+
*/
|
|
9
45
|
SINGLEJSON = "singlejson",
|
|
46
|
+
/**
|
|
47
|
+
* The data stream is a concatenation of JSON documents (property bags all).
|
|
48
|
+
*/
|
|
49
|
+
MULTIJSON = "multijson",
|
|
50
|
+
/**
|
|
51
|
+
* Avro format.
|
|
52
|
+
*/
|
|
10
53
|
AVRO = "avro",
|
|
54
|
+
/**
|
|
55
|
+
* Parquet format.
|
|
56
|
+
*/
|
|
11
57
|
PARQUET = "parquet",
|
|
12
|
-
|
|
13
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Microsoft Cosmos structured streams format
|
|
60
|
+
*/
|
|
61
|
+
SSTREAM = "sstream",
|
|
62
|
+
/**
|
|
63
|
+
* The Optimized Row Columnar (ORC)
|
|
64
|
+
*/
|
|
65
|
+
ORC = "orc",
|
|
66
|
+
/**
|
|
67
|
+
* Avro format for ingesting through avro2json.
|
|
68
|
+
*/
|
|
69
|
+
APACHEAVRO = "apacheavro",
|
|
70
|
+
/**
|
|
71
|
+
* W3C Extended Log File format.
|
|
72
|
+
*/
|
|
73
|
+
W3CLogFile = "w3clogfile"
|
|
14
74
|
}
|
|
15
|
-
export declare enum
|
|
75
|
+
export declare enum IngestionMappingKind {
|
|
16
76
|
CSV = "Csv",
|
|
17
|
-
PARQUET = "Parquet",
|
|
18
|
-
AVRO = "Avro",
|
|
19
77
|
JSON = "Json",
|
|
20
|
-
|
|
78
|
+
AVRO = "Avro",
|
|
79
|
+
PARQUET = "Parquet",
|
|
80
|
+
SSTREAM = "SStream",
|
|
81
|
+
ORC = "orc",
|
|
82
|
+
APACHEAVRO = "ApacheAvro",
|
|
83
|
+
W3CLOGFILE = "W3CLogFile"
|
|
21
84
|
}
|
|
85
|
+
export declare const dataFormatMappingKind: (dataFormat: DataFormat) => IngestionMappingKind;
|
|
22
86
|
export declare enum ValidationOptions {
|
|
23
87
|
DoNotValidate = 0,
|
|
24
88
|
ValidateCsvInputConstantColumns = 1,
|
|
@@ -32,6 +96,7 @@ export declare class ValidationPolicy {
|
|
|
32
96
|
readonly validationOptions: ValidationOptions;
|
|
33
97
|
readonly validationImplications: ValidationImplications;
|
|
34
98
|
constructor(validationOptions?: ValidationOptions, validationImplications?: ValidationImplications);
|
|
99
|
+
toJSON(): Record<string, number>;
|
|
35
100
|
}
|
|
36
101
|
export declare enum ReportLevel {
|
|
37
102
|
FailuresOnly = 0,
|
|
@@ -39,45 +104,44 @@ export declare enum ReportLevel {
|
|
|
39
104
|
FailuresAndSuccesses = 2
|
|
40
105
|
}
|
|
41
106
|
export declare enum ReportMethod {
|
|
42
|
-
Queue = 0
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
export declare class CsvColumnMapping extends ColumnMapping {
|
|
47
|
-
readonly columnName: string;
|
|
48
|
-
readonly cslDataType: string;
|
|
49
|
-
readonly ordinal: string;
|
|
50
|
-
constructor(columnName: string, cslDataType: string, ordinal: string);
|
|
107
|
+
Queue = 0,
|
|
108
|
+
Table = 1,
|
|
109
|
+
QueueAndTable = 2
|
|
51
110
|
}
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
111
|
+
export interface IngestionPropertiesFields {
|
|
112
|
+
database?: string;
|
|
113
|
+
table?: string;
|
|
114
|
+
format?: DataFormat;
|
|
115
|
+
/**
|
|
116
|
+
* @deprecated. Use ingestionMappingColumns instead.
|
|
117
|
+
*/
|
|
118
|
+
ingestionMapping?: ColumnMapping[];
|
|
119
|
+
ingestionMappingColumns?: ColumnMapping[];
|
|
120
|
+
ingestionMappingReference?: string;
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated. Use ingestionMappingKind instead.
|
|
123
|
+
*/
|
|
124
|
+
ingestionMappingType?: IngestionMappingKind;
|
|
125
|
+
ingestionMappingKind?: IngestionMappingKind;
|
|
126
|
+
additionalTags?: string;
|
|
127
|
+
ingestIfNotExists?: string;
|
|
128
|
+
ingestByTags?: string[];
|
|
129
|
+
dropByTags?: string[];
|
|
130
|
+
flushImmediately?: boolean;
|
|
131
|
+
reportLevel?: ReportLevel;
|
|
132
|
+
reportMethod?: ReportMethod;
|
|
133
|
+
validationPolicy?: ValidationPolicy;
|
|
73
134
|
additionalProperties?: {
|
|
74
135
|
[additional: string]: any;
|
|
75
136
|
} | null;
|
|
76
137
|
}
|
|
77
|
-
export
|
|
78
|
-
|
|
138
|
+
export interface IngestionProperties extends IngestionPropertiesFields {
|
|
139
|
+
}
|
|
140
|
+
export declare class IngestionProperties {
|
|
141
|
+
constructor(data: Partial<IngestionPropertiesFields>);
|
|
79
142
|
validate(): void;
|
|
80
|
-
|
|
81
|
-
|
|
143
|
+
merge(extraProps: IngestionPropertiesInput): IngestionProperties;
|
|
144
|
+
setDefaults(): void;
|
|
82
145
|
}
|
|
146
|
+
export declare type IngestionPropertiesInput = IngestionProperties | IngestionPropertiesFields | null | undefined;
|
|
83
147
|
export default IngestionProperties;
|
|
@@ -2,30 +2,135 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.IngestionProperties = exports.
|
|
5
|
+
exports.IngestionProperties = exports.ReportMethod = exports.ReportLevel = exports.ValidationPolicy = exports.ValidationImplications = exports.ValidationOptions = exports.dataFormatMappingKind = exports.IngestionMappingKind = exports.DataFormat = void 0;
|
|
6
|
+
/* eslint-disable max-classes-per-file -- the main class is IngestionProperties, ValidationPolicy is a tiny class */
|
|
7
|
+
const errors_1 = require("./errors");
|
|
8
|
+
/**
|
|
9
|
+
* Data formats supported for Kusto ingestion.
|
|
10
|
+
*/
|
|
6
11
|
var DataFormat;
|
|
7
12
|
(function (DataFormat) {
|
|
13
|
+
/**
|
|
14
|
+
* Comma-separated value.
|
|
15
|
+
*/
|
|
8
16
|
DataFormat["CSV"] = "csv";
|
|
17
|
+
/**
|
|
18
|
+
* Tab-separated value.
|
|
19
|
+
*/
|
|
9
20
|
DataFormat["TSV"] = "tsv";
|
|
21
|
+
/**
|
|
22
|
+
* Semicolon-separated value (the unique Azure Storage log format).
|
|
23
|
+
*/
|
|
10
24
|
DataFormat["SCSV"] = "scsv";
|
|
25
|
+
/**
|
|
26
|
+
* Start-Of-Header (CTRL-A)-separated value.
|
|
27
|
+
*/
|
|
11
28
|
DataFormat["SOHSV"] = "sohsv";
|
|
29
|
+
/**
|
|
30
|
+
* Pipeline-separated value (used by Cosmos).
|
|
31
|
+
*/
|
|
12
32
|
DataFormat["PSV"] = "psv";
|
|
33
|
+
/**
|
|
34
|
+
* Each record is a line and has just one field.
|
|
35
|
+
*/
|
|
13
36
|
DataFormat["TXT"] = "txt";
|
|
37
|
+
/**
|
|
38
|
+
* Whole stream is a single record with a single field.
|
|
39
|
+
*/
|
|
40
|
+
DataFormat["RAW"] = "raw";
|
|
41
|
+
/**
|
|
42
|
+
* Tab-separated value with '\' escaping character.
|
|
43
|
+
*/
|
|
44
|
+
DataFormat["TSVE"] = "tsve";
|
|
45
|
+
/**
|
|
46
|
+
* Data is in a JSON format, each line is record with a single JSON value.
|
|
47
|
+
*/
|
|
14
48
|
DataFormat["JSON"] = "json";
|
|
49
|
+
/**
|
|
50
|
+
* Data stream holds a single JSON value -- newlines are regular whitespace.
|
|
51
|
+
*/
|
|
15
52
|
DataFormat["SINGLEJSON"] = "singlejson";
|
|
53
|
+
/**
|
|
54
|
+
* The data stream is a concatenation of JSON documents (property bags all).
|
|
55
|
+
*/
|
|
56
|
+
DataFormat["MULTIJSON"] = "multijson";
|
|
57
|
+
/**
|
|
58
|
+
* Avro format.
|
|
59
|
+
*/
|
|
16
60
|
DataFormat["AVRO"] = "avro";
|
|
61
|
+
/**
|
|
62
|
+
* Parquet format.
|
|
63
|
+
*/
|
|
17
64
|
DataFormat["PARQUET"] = "parquet";
|
|
18
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Microsoft Cosmos structured streams format
|
|
67
|
+
*/
|
|
68
|
+
DataFormat["SSTREAM"] = "sstream";
|
|
69
|
+
/**
|
|
70
|
+
* The Optimized Row Columnar (ORC)
|
|
71
|
+
*/
|
|
19
72
|
DataFormat["ORC"] = "orc";
|
|
73
|
+
/**
|
|
74
|
+
* Avro format for ingesting through avro2json.
|
|
75
|
+
*/
|
|
76
|
+
DataFormat["APACHEAVRO"] = "apacheavro";
|
|
77
|
+
/**
|
|
78
|
+
* W3C Extended Log File format.
|
|
79
|
+
*/
|
|
80
|
+
DataFormat["W3CLogFile"] = "w3clogfile";
|
|
20
81
|
})(DataFormat = exports.DataFormat || (exports.DataFormat = {}));
|
|
21
|
-
var
|
|
22
|
-
(function (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
82
|
+
var IngestionMappingKind;
|
|
83
|
+
(function (IngestionMappingKind) {
|
|
84
|
+
IngestionMappingKind["CSV"] = "Csv";
|
|
85
|
+
IngestionMappingKind["JSON"] = "Json";
|
|
86
|
+
IngestionMappingKind["AVRO"] = "Avro";
|
|
87
|
+
IngestionMappingKind["PARQUET"] = "Parquet";
|
|
88
|
+
IngestionMappingKind["SSTREAM"] = "SStream";
|
|
89
|
+
IngestionMappingKind["ORC"] = "orc";
|
|
90
|
+
IngestionMappingKind["APACHEAVRO"] = "ApacheAvro";
|
|
91
|
+
IngestionMappingKind["W3CLOGFILE"] = "W3CLogFile";
|
|
92
|
+
})(IngestionMappingKind = exports.IngestionMappingKind || (exports.IngestionMappingKind = {}));
|
|
93
|
+
const dataFormatMappingKind = (dataFormat) => {
|
|
94
|
+
switch (dataFormat) {
|
|
95
|
+
case DataFormat.CSV:
|
|
96
|
+
return IngestionMappingKind.CSV;
|
|
97
|
+
case DataFormat.TSV:
|
|
98
|
+
return IngestionMappingKind.CSV;
|
|
99
|
+
case DataFormat.SCSV:
|
|
100
|
+
return IngestionMappingKind.CSV;
|
|
101
|
+
case DataFormat.SOHSV:
|
|
102
|
+
return IngestionMappingKind.CSV;
|
|
103
|
+
case DataFormat.PSV:
|
|
104
|
+
return IngestionMappingKind.CSV;
|
|
105
|
+
case DataFormat.TXT:
|
|
106
|
+
return IngestionMappingKind.CSV;
|
|
107
|
+
case DataFormat.RAW:
|
|
108
|
+
return IngestionMappingKind.CSV;
|
|
109
|
+
case DataFormat.TSVE:
|
|
110
|
+
return IngestionMappingKind.CSV;
|
|
111
|
+
case DataFormat.JSON:
|
|
112
|
+
return IngestionMappingKind.JSON;
|
|
113
|
+
case DataFormat.SINGLEJSON:
|
|
114
|
+
return IngestionMappingKind.JSON;
|
|
115
|
+
case DataFormat.MULTIJSON:
|
|
116
|
+
return IngestionMappingKind.JSON;
|
|
117
|
+
case DataFormat.AVRO:
|
|
118
|
+
return IngestionMappingKind.AVRO;
|
|
119
|
+
case DataFormat.PARQUET:
|
|
120
|
+
return IngestionMappingKind.PARQUET;
|
|
121
|
+
case DataFormat.SSTREAM:
|
|
122
|
+
return IngestionMappingKind.SSTREAM;
|
|
123
|
+
case DataFormat.ORC:
|
|
124
|
+
return IngestionMappingKind.ORC;
|
|
125
|
+
case DataFormat.APACHEAVRO:
|
|
126
|
+
return IngestionMappingKind.APACHEAVRO;
|
|
127
|
+
case DataFormat.W3CLogFile:
|
|
128
|
+
return IngestionMappingKind.W3CLOGFILE;
|
|
129
|
+
default:
|
|
130
|
+
throw new errors_1.IngestionPropertiesValidationError(`Unsupported data format: ${dataFormat}`);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
exports.dataFormatMappingKind = dataFormatMappingKind;
|
|
29
134
|
var ValidationOptions;
|
|
30
135
|
(function (ValidationOptions) {
|
|
31
136
|
ValidationOptions[ValidationOptions["DoNotValidate"] = 0] = "DoNotValidate";
|
|
@@ -42,6 +147,12 @@ class ValidationPolicy {
|
|
|
42
147
|
this.validationOptions = validationOptions;
|
|
43
148
|
this.validationImplications = validationImplications;
|
|
44
149
|
}
|
|
150
|
+
toJSON() {
|
|
151
|
+
return {
|
|
152
|
+
ValidationOptions: this.validationOptions,
|
|
153
|
+
ValidationImplications: this.validationImplications,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
45
156
|
}
|
|
46
157
|
exports.ValidationPolicy = ValidationPolicy;
|
|
47
158
|
var ReportLevel;
|
|
@@ -53,94 +164,79 @@ var ReportLevel;
|
|
|
53
164
|
var ReportMethod;
|
|
54
165
|
(function (ReportMethod) {
|
|
55
166
|
ReportMethod[ReportMethod["Queue"] = 0] = "Queue";
|
|
167
|
+
ReportMethod[ReportMethod["Table"] = 1] = "Table";
|
|
168
|
+
ReportMethod[ReportMethod["QueueAndTable"] = 2] = "QueueAndTable";
|
|
56
169
|
})(ReportMethod = exports.ReportMethod || (exports.ReportMethod = {}));
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
super();
|
|
62
|
-
this.columnName = columnName;
|
|
63
|
-
this.cslDataType = cslDataType;
|
|
64
|
-
this.ordinal = ordinal;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.CsvColumnMapping = CsvColumnMapping;
|
|
68
|
-
class JsonColumnMapping extends ColumnMapping {
|
|
69
|
-
constructor(columnName, jsonPath, cslDataType = null) {
|
|
70
|
-
super();
|
|
71
|
-
this.columnName = columnName;
|
|
72
|
-
this.jsonPath = jsonPath;
|
|
73
|
-
this.cslDataType = cslDataType;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.JsonColumnMapping = JsonColumnMapping;
|
|
77
|
-
class IngestionPropertiesFields {
|
|
78
|
-
constructor() {
|
|
79
|
-
this.database = null;
|
|
80
|
-
this.table = null;
|
|
81
|
-
this.format = null;
|
|
82
|
-
this.ingestionMapping = null;
|
|
83
|
-
this.ingestionMappingReference = null;
|
|
84
|
-
this.ingestionMappingType = null;
|
|
85
|
-
this.additionalTags = null;
|
|
86
|
-
this.ingestIfNotExists = null;
|
|
87
|
-
this.ingestByTags = null;
|
|
88
|
-
this.dropByTags = null;
|
|
89
|
-
this.flushImmediately = null;
|
|
90
|
-
this.reportLevel = null;
|
|
91
|
-
this.reportMethod = null;
|
|
92
|
-
this.validationPolicy = null;
|
|
93
|
-
this.additionalProperties = null;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
class IngestionProperties extends IngestionPropertiesFields {
|
|
97
|
-
constructor({ database = null, table = null, format = null, ingestionMapping = null, ingestionMappingReference = null, ingestionMappingType = null, additionalTags = null, ingestIfNotExists = null, ingestByTags = null, dropByTags = null, flushImmediately = null, reportLevel = null, reportMethod = null, validationPolicy = null, additionalProperties = null }) {
|
|
98
|
-
super();
|
|
99
|
-
if (ingestionMapping && ingestionMappingReference)
|
|
100
|
-
throw new Error("Both mapping and a mapping reference detected");
|
|
101
|
-
this.database = database;
|
|
102
|
-
this.table = table;
|
|
103
|
-
this.format = format;
|
|
104
|
-
this.ingestionMapping = ingestionMapping;
|
|
105
|
-
this.ingestionMappingType = ingestionMappingType;
|
|
106
|
-
this.ingestionMappingReference = ingestionMappingReference;
|
|
107
|
-
this.additionalTags = additionalTags;
|
|
108
|
-
this.ingestIfNotExists = ingestIfNotExists;
|
|
109
|
-
this.ingestByTags = ingestByTags;
|
|
110
|
-
this.dropByTags = dropByTags;
|
|
111
|
-
this.flushImmediately = flushImmediately;
|
|
112
|
-
this.reportLevel = reportLevel;
|
|
113
|
-
this.reportMethod = reportMethod;
|
|
114
|
-
this.validationPolicy = validationPolicy;
|
|
115
|
-
this.additionalProperties = additionalProperties;
|
|
170
|
+
// eslint-disable-next-line no-redeclare
|
|
171
|
+
class IngestionProperties {
|
|
172
|
+
constructor(data) {
|
|
173
|
+
Object.assign(this, data);
|
|
116
174
|
}
|
|
117
175
|
validate() {
|
|
118
|
-
if (!this.flushImmediately)
|
|
119
|
-
this.flushImmediately = false;
|
|
120
|
-
if (!this.reportLevel)
|
|
121
|
-
this.reportLevel = ReportLevel.DoNotReport;
|
|
122
|
-
if (!this.reportMethod)
|
|
123
|
-
this.reportMethod = ReportMethod.Queue;
|
|
124
176
|
if (!this.database)
|
|
125
|
-
throw new
|
|
177
|
+
throw new errors_1.IngestionPropertiesValidationError("Must define a target database");
|
|
126
178
|
if (!this.table)
|
|
127
|
-
throw new
|
|
179
|
+
throw new errors_1.IngestionPropertiesValidationError("Must define a target table");
|
|
128
180
|
if (!this.format)
|
|
129
|
-
throw new
|
|
130
|
-
if (this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
181
|
+
throw new errors_1.IngestionPropertiesValidationError("Must define a data format");
|
|
182
|
+
if (this.ingestionMappingType && !this.ingestionMappingKind) {
|
|
183
|
+
this.ingestionMappingKind = this.ingestionMappingType;
|
|
184
|
+
}
|
|
185
|
+
if (this.ingestionMapping && !this.ingestionMappingColumns) {
|
|
186
|
+
this.ingestionMappingColumns = this.ingestionMapping;
|
|
187
|
+
}
|
|
188
|
+
if (!this.ingestionMappingColumns && !this.ingestionMappingReference) {
|
|
189
|
+
if (this.ingestionMappingKind) {
|
|
190
|
+
throw new errors_1.IngestionPropertiesValidationError("Cannot define ingestionMappingKind without either ingestionMappingColumns or" + " ingestionMappingReference");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
const mappingKind = (0, exports.dataFormatMappingKind)(this.format);
|
|
195
|
+
if (this.ingestionMappingKind && this.ingestionMappingKind !== mappingKind) {
|
|
196
|
+
throw new errors_1.IngestionPropertiesValidationError(`Mapping kind '${this.ingestionMappingKind}' does not match format '${this.format}' (should be '${mappingKind}')`);
|
|
197
|
+
}
|
|
198
|
+
if (this.ingestionMappingColumns) {
|
|
199
|
+
if (this.ingestionMappingReference) {
|
|
200
|
+
throw new errors_1.IngestionPropertiesValidationError("Cannot define both ingestionMappingColumns and ingestionMappingReference");
|
|
201
|
+
}
|
|
202
|
+
if (this.ingestionMappingColumns.length === 0) {
|
|
203
|
+
throw new errors_1.IngestionPropertiesValidationError("Must define at least one column mapping");
|
|
204
|
+
}
|
|
205
|
+
const wrongMappings = this.ingestionMappingColumns
|
|
206
|
+
.filter((m) => m.mappingKind !== mappingKind)
|
|
207
|
+
.map((m) => `Mapping kind mismatch for column '${m.columnName}' - expected data format kind - '${mappingKind}', but was '${m.mappingKind}'`);
|
|
208
|
+
if (wrongMappings.length > 0) {
|
|
209
|
+
throw new errors_1.IngestionPropertiesValidationError(`Invalid columns:\n${wrongMappings.join("\n")}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
134
213
|
}
|
|
135
214
|
merge(extraProps) {
|
|
136
215
|
const merged = new IngestionProperties(this);
|
|
216
|
+
if (!extraProps) {
|
|
217
|
+
return merged;
|
|
218
|
+
}
|
|
219
|
+
const assign = (obj, prop, value) => {
|
|
220
|
+
obj[prop] = value;
|
|
221
|
+
};
|
|
137
222
|
for (const key of Object.keys(extraProps)) {
|
|
138
|
-
if (extraProps[key]
|
|
139
|
-
merged
|
|
223
|
+
if (extraProps[key]) {
|
|
224
|
+
assign(merged, key, extraProps[key]);
|
|
140
225
|
}
|
|
141
226
|
}
|
|
142
227
|
return merged;
|
|
143
228
|
}
|
|
229
|
+
setDefaults() {
|
|
230
|
+
if (!this.format) {
|
|
231
|
+
this.format = DataFormat.CSV;
|
|
232
|
+
}
|
|
233
|
+
if (!this.reportLevel) {
|
|
234
|
+
this.reportLevel = ReportLevel.FailuresOnly;
|
|
235
|
+
}
|
|
236
|
+
if (!this.reportMethod) {
|
|
237
|
+
this.reportMethod = ReportMethod.Queue;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
144
240
|
}
|
|
145
241
|
exports.IngestionProperties = IngestionProperties;
|
|
146
242
|
exports.default = IngestionProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestionProperties.js","sourceRoot":"","sources":["ingestionProperties.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,IAAY,
|
|
1
|
+
{"version":3,"file":"ingestionProperties.js","sourceRoot":"","sources":["ingestionProperties.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,oHAAoH;AAEpH,qCAA8D;AAG9D;;GAEG;AACH,IAAY,UAqEX;AArED,WAAY,UAAU;IAClB;;OAEG;IACH,yBAAW,CAAA;IACX;;OAEG;IACH,yBAAW,CAAA;IACX;;OAEG;IACH,2BAAa,CAAA;IACb;;OAEG;IACH,6BAAe,CAAA;IACf;;OAEG;IACH,yBAAW,CAAA;IACX;;OAEG;IACH,yBAAW,CAAA;IACX;;OAEG;IACH,yBAAW,CAAA;IACX;;OAEG;IACH,2BAAa,CAAA;IACb;;OAEG;IACH,2BAAa,CAAA;IACb;;OAEG;IACH,uCAAyB,CAAA;IACzB;;OAEG;IACH,qCAAuB,CAAA;IACvB;;OAEG;IACH,2BAAa,CAAA;IACb;;OAEG;IACH,iCAAmB,CAAA;IACnB;;OAEG;IACH,iCAAmB,CAAA;IACnB;;OAEG;IACH,yBAAW,CAAA;IACX;;OAEG;IACH,uCAAyB,CAAA;IACzB;;OAEG;IACH,uCAAyB,CAAA;AAC7B,CAAC,EArEW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAqErB;AAED,IAAY,oBASX;AATD,WAAY,oBAAoB;IAC5B,mCAAW,CAAA;IACX,qCAAa,CAAA;IACb,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,2CAAmB,CAAA;IACnB,mCAAW,CAAA;IACX,iDAAyB,CAAA;IACzB,iDAAyB,CAAA;AAC7B,CAAC,EATW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAS/B;AAEM,MAAM,qBAAqB,GAAG,CAAC,UAAsB,EAAwB,EAAE;IAClF,QAAQ,UAAU,EAAE;QAChB,KAAK,UAAU,CAAC,GAAG;YACf,OAAO,oBAAoB,CAAC,GAAG,CAAC;QACpC,KAAK,UAAU,CAAC,GAAG;YACf,OAAO,oBAAoB,CAAC,GAAG,CAAC;QACpC,KAAK,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} from "./ingestionProperties";
|
|
3
|
+
import { FileDescriptor, StreamDescriptor } from "./descriptors";
|
|
4
|
+
import { AbstractKustoClient } from "./abstractKustoClient";
|
|
5
|
+
import { KustoConnectionStringBuilder } from "azure-kusto-data";
|
|
6
|
+
import { KustoResponseDataSet } from "azure-kusto-data/source/response";
|
|
7
|
+
import { QueueSendMessageResponse } from "@azure/storage-queue";
|
|
8
|
+
import { Readable } from "stream";
|
|
9
|
+
declare class KustoManagedStreamingIngestClient extends AbstractKustoClient {
|
|
10
|
+
private streamingIngestClient;
|
|
11
|
+
private queuedIngestClient;
|
|
12
|
+
private baseSleepTimeSecs;
|
|
13
|
+
private baseJitterSecs;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a KustoManagedStreamingIngestClient from a DM connection string.
|
|
16
|
+
* This method infers the engine connection string.
|
|
17
|
+
* For advanced usage, use the constructor that takes a DM connection string and an engine connection string.
|
|
18
|
+
*
|
|
19
|
+
* @param dmConnectionString The DM connection string.
|
|
20
|
+
* @param defaultProps The default ingestion properties.
|
|
21
|
+
*/
|
|
22
|
+
static fromDmConnectionString(dmConnectionString: KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput): KustoManagedStreamingIngestClient;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a KustoManagedStreamingIngestClient from a engine connection string.
|
|
25
|
+
* This method infers the engine connection string.
|
|
26
|
+
* For advanced usage, use the constructor that takes an engine connection string and an engine connection string.
|
|
27
|
+
*
|
|
28
|
+
* @param engineConnectionString The engine connection string.
|
|
29
|
+
* @param defaultProps The default ingestion properties.
|
|
30
|
+
*/
|
|
31
|
+
static fromEngineConnectionString(engineConnectionString: KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput): KustoManagedStreamingIngestClient;
|
|
32
|
+
constructor(engineKcsb: string | KustoConnectionStringBuilder, dmKcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput);
|
|
33
|
+
ingestFromStream(stream: StreamDescriptor | Readable, ingestionProperties?: IngestionPropertiesInput): Promise<any>;
|
|
34
|
+
ingestFromFile(file: FileDescriptor | string, ingestionProperties?: IngestionPropertiesInput): Promise<KustoResponseDataSet | QueueSendMessageResponse>;
|
|
35
|
+
}
|
|
36
|
+
export default KustoManagedStreamingIngestClient;
|