azure-kusto-ingest 6.0.3 → 6.0.4
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.
|
@@ -27,16 +27,16 @@ class IngestionBlobInfo {
|
|
|
27
27
|
additionalProperties.authorizationContext = authContext;
|
|
28
28
|
const tags = [];
|
|
29
29
|
if (ingestionProperties.additionalTags) {
|
|
30
|
-
tags.
|
|
30
|
+
tags.push(...ingestionProperties.additionalTags);
|
|
31
31
|
}
|
|
32
32
|
if (ingestionProperties.dropByTags) {
|
|
33
|
-
tags.
|
|
33
|
+
tags.push(...ingestionProperties.dropByTags.map((t) => "drop-by:" + t));
|
|
34
34
|
}
|
|
35
35
|
if (ingestionProperties.ingestByTags) {
|
|
36
|
-
tags.
|
|
36
|
+
tags.push(...ingestionProperties.ingestByTags.map((t) => "ingest-by:" + t));
|
|
37
37
|
}
|
|
38
|
-
if (tags
|
|
39
|
-
additionalProperties.tags = tags;
|
|
38
|
+
if (tags.length > 0) {
|
|
39
|
+
additionalProperties.tags = JSON.stringify(tags);
|
|
40
40
|
}
|
|
41
41
|
if (ingestionProperties.ingestIfNotExists) {
|
|
42
42
|
additionalProperties.ingestIfNotExists = ingestionProperties.ingestIfNotExists;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestionBlobInfo.js","sourceRoot":"","sources":["../../src/ingestionBlobInfo.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,+BAAoC;AAKpC,MAAa,iBAAiB;IAiB1B,YACI,cAA8B,EAC9B,mBAAwC,EACxC,cAA6B,IAAI,EACjC,wBAAuC,IAAI,EAC3C,0BAAyC,IAAI;;QATjD,2BAAsB,GAA6C,IAAI,CAAC;QACxE,0BAAqB,GAAmB,IAAI,CAAC;QAC7C,4BAAuB,GAAmB,IAAI,CAAC;QAS3C,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,W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BAAmB,CAAC,gBAAgB,CAAC;QACjF,CAAC;QAED,IAAI,mBAAmB,CAAC,MAAM,EAAE,CAAC;YAC7B,oBAAoB,CAAC,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC;QAC7D,CAAC;QACD,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,CAAC;YACxC,oBAAoB,CAAC,iBAAiB,GAAG,mBAAmB,CAAC,iBAAiB,CAAC;QACnF,CAAC;QAED,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACrD,CAAC;CACJ;AAtFD,8CAsFC;AAED,kBAAe,iBAAiB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { v4 as uuidv4 } from \"uuid\";\nimport { BlobDescriptor } from \"./descriptors\";\nimport IngestionProperties, { ReportLevel, ReportMethod } from \"./ingestionProperties\";\nimport { IngestionStatusInTableDescription } from \"./ingestionResult\";\n\nexport class IngestionBlobInfo {\n BlobPath: string;\n RawDataSize: number | null;\n DatabaseName: string | null;\n TableName: string | null;\n RetainBlobOnSuccess: boolean;\n FlushImmediately: boolean;\n IgnoreSizeLimit: boolean;\n ReportLevel: ReportLevel | null;\n ReportMethod: ReportMethod | null;\n SourceMessageCreationTime: Date;\n Id: string;\n AdditionalProperties: { [additional: string]: any };\n IngestionStatusInTable: IngestionStatusInTableDescription | null = null;\n ApplicationForTracing?: string | null = null;\n ClientVersionForTracing?: string | null = null;\n\n constructor(\n blobDescriptor: BlobDescriptor,\n ingestionProperties: IngestionProperties,\n authContext: string | null = null,\n applicationForTracing: string | null = null,\n clientVersionForTracing: string | null = null\n ) {\n this.BlobPath = blobDescriptor.path;\n this.RawDataSize = blobDescriptor.size;\n this.DatabaseName = ingestionProperties.database ?? null;\n this.TableName = ingestionProperties.table ?? null;\n this.RetainBlobOnSuccess = true;\n this.FlushImmediately = ingestionProperties.flushImmediately ?? false;\n this.IgnoreSizeLimit = false;\n this.ReportLevel = ingestionProperties.reportLevel ?? null;\n this.ReportMethod = ingestionProperties.reportMethod ?? null;\n this.SourceMessageCreationTime = new Date();\n this.Id = blobDescriptor.sourceId || uuidv4();\n this.ApplicationForTracing = applicationForTracing;\n this.ClientVersionForTracing = clientVersionForTracing;\n\n const additionalProperties = ingestionProperties.additionalProperties || {};\n additionalProperties.authorizationContext = authContext;\n\n const tags: string[] = [];\n if (ingestionProperties.additionalTags) {\n tags.push(...ingestionProperties.additionalTags);\n }\n if (ingestionProperties.dropByTags) {\n tags.push(...ingestionProperties.dropByTags.map((t) => \"drop-by:\" + t));\n }\n if (ingestionProperties.ingestByTags) {\n tags.push(...ingestionProperties.ingestByTags.map((t) => \"ingest-by:\" + t));\n }\n\n if (tags.length > 0) {\n additionalProperties.tags = JSON.stringify(tags);\n }\n\n if (ingestionProperties.ingestIfNotExists) {\n additionalProperties.ingestIfNotExists = ingestionProperties.ingestIfNotExists;\n }\n\n if (ingestionProperties.ingestionMappingColumns && ingestionProperties.ingestionMappingColumns.length > 0) {\n // server expects a string\n additionalProperties.ingestionMapping = JSON.stringify(ingestionProperties.ingestionMappingColumns.map((m) => m.toApiMapping()));\n }\n\n if (ingestionProperties.ingestionMappingReference) {\n additionalProperties.ingestionMappingReference = ingestionProperties.ingestionMappingReference;\n }\n\n if (ingestionProperties.ingestionMappingKind) {\n additionalProperties.ingestionMappingType = ingestionProperties.ingestionMappingKind;\n }\n\n if (ingestionProperties.validationPolicy) {\n additionalProperties.ValidationPolicy = ingestionProperties.validationPolicy;\n }\n\n if (ingestionProperties.format) {\n additionalProperties.format = ingestionProperties.format;\n }\n if (ingestionProperties.ignoreFirstRecord) {\n additionalProperties.ignoreFirstRecord = ingestionProperties.ignoreFirstRecord;\n }\n\n this.AdditionalProperties = additionalProperties;\n }\n}\n\nexport default IngestionBlobInfo;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestionProperties.js","sourceRoot":"","sources":["../../src/ingestionProperties.ts"],"names":[],"mappings":";AAAA,uCA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CAAC,YAAY,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC;QAC3C,CAAC;IACL,CAAC;CACJ;AA3FD,kDA2FC;AAID,SAAgB,0BAA0B,CAAC,mBAA8C;IACrF,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvB,mBAAmB,GAAG,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,CACJ,mBAAmB,CAAC,MAAM,KAAK,MAAM;QACrC,mBAAmB,CAAC,MAAM,KAAK,SAAS;QACxC,mBAAmB,CAAC,MAAM,KAAK,KAAK;QACpC,mBAAmB,CAAC,MAAM,KAAK,YAAY;QAC3C,mBAAmB,CAAC,MAAM,KAAK,SAAS,CAC3C,CAAC;AACN,CAAC;AAED,kBAAe,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IngestionPropertiesValidationError } from \"./errors\";\nimport { ColumnMapping } from \"./columnMappings\";\n\n/**\n * Data formats supported for Kusto ingestion.\n */\nexport enum DataFormat {\n /**\n * Comma-separated value.\n */\n CSV = \"csv\",\n /**\n * Tab-separated value.\n */\n TSV = \"tsv\",\n /**\n * Semicolon-separated value (the unique Azure Storage log format).\n */\n SCSV = \"scsv\",\n /**\n * Start-Of-Header (CTRL-A)-separated value.\n */\n SOHSV = \"sohsv\",\n /**\n * Pipeline-separated value (used by Cosmos).\n */\n PSV = \"psv\",\n /**\n * Each record is a line and has just one field.\n */\n TXT = \"txt\",\n /**\n * Whole stream is a single record with a single field.\n */\n RAW = \"raw\",\n /**\n * Tab-separated value with '\\' escaping character.\n */\n TSVE = \"tsve\",\n /**\n * Data is in a JSON format, each line is record with a single JSON value.\n */\n JSON = \"json\",\n /**\n * Data stream holds a single JSON value -- newlines are regular whitespace.\n */\n SINGLEJSON = \"singlejson\",\n /**\n * The data stream is a concatenation of JSON documents (property bags all).\n */\n MULTIJSON = \"multijson\",\n /**\n * Avro format.\n */\n AVRO = \"avro\",\n /**\n * Parquet format.\n */\n PARQUET = \"parquet\",\n /**\n * Microsoft Cosmos structured streams format\n */\n SSTREAM = \"sstream\",\n /**\n * The Optimized Row Columnar (ORC)\n */\n ORC = \"orc\",\n /**\n * Avro format for ingesting through avro2json.\n */\n APACHEAVRO = \"apacheavro\",\n /**\n * W3C Extended Log File format.\n */\n W3CLogFile = \"w3clogfile\",\n}\n\nexport enum IngestionMappingKind {\n CSV = \"Csv\",\n JSON = \"Json\",\n AVRO = \"Avro\",\n PARQUET = \"Parquet\",\n SSTREAM = \"SStream\",\n ORC = \"orc\",\n APACHEAVRO = \"ApacheAvro\",\n W3CLOGFILE = \"W3CLogFile\",\n}\n\nexport const dataFormatMappingKind = (dataFormat: DataFormat): IngestionMappingKind => {\n switch (dataFormat) {\n case DataFormat.CSV:\n return IngestionMappingKind.CSV;\n case DataFormat.TSV:\n return IngestionMappingKind.CSV;\n case DataFormat.SCSV:\n return IngestionMappingKind.CSV;\n case DataFormat.SOHSV:\n return IngestionMappingKind.CSV;\n case DataFormat.PSV:\n return IngestionMappingKind.CSV;\n case DataFormat.TXT:\n return IngestionMappingKind.CSV;\n case DataFormat.RAW:\n return IngestionMappingKind.CSV;\n case DataFormat.TSVE:\n return IngestionMappingKind.CSV;\n case DataFormat.JSON:\n return IngestionMappingKind.JSON;\n case DataFormat.SINGLEJSON:\n return IngestionMappingKind.JSON;\n case DataFormat.MULTIJSON:\n return IngestionMappingKind.JSON;\n case DataFormat.AVRO:\n return IngestionMappingKind.AVRO;\n case DataFormat.PARQUET:\n return IngestionMappingKind.PARQUET;\n case DataFormat.SSTREAM:\n return IngestionMappingKind.SSTREAM;\n case DataFormat.ORC:\n return IngestionMappingKind.ORC;\n case DataFormat.APACHEAVRO:\n return IngestionMappingKind.APACHEAVRO;\n case DataFormat.W3CLogFile:\n return IngestionMappingKind.W3CLOGFILE;\n default:\n throw new IngestionPropertiesValidationError(`Unsupported data format: ${dataFormat}`);\n }\n};\n\nexport enum ValidationOptions {\n DoNotValidate = 0,\n ValidateCsvInputConstantColumns = 1,\n ValidateCsvInputColumnLevelOnly = 2,\n}\n\nexport enum ValidationImplications {\n Fail = 0,\n BestEffort = 1,\n}\n\nexport class ValidationPolicy {\n constructor(\n readonly validationOptions: ValidationOptions = ValidationOptions.DoNotValidate,\n readonly validationImplications: ValidationImplications = ValidationImplications.BestEffort\n ) {}\n\n toJSON(): Record<string, number> {\n return {\n ValidationOptions: this.validationOptions,\n ValidationImplications: this.validationImplications,\n };\n }\n}\n\nexport enum ReportLevel {\n FailuresOnly = 0,\n DoNotReport = 1,\n FailuresAndSuccesses = 2,\n}\n\nexport enum ReportMethod {\n Queue = 0,\n Table,\n QueueAndTable,\n}\n\nexport interface IngestionPropertiesFields {\n database?: string;\n table?: string;\n format?: DataFormat;\n /**\n * @deprecated. Use ingestionMappingColumns instead.\n */\n ingestionMapping?: ColumnMapping[];\n ingestionMappingColumns?: ColumnMapping[];\n ingestionMappingReference?: string;\n /**\n * @deprecated. Use ingestionMappingKind instead.\n */\n ingestionMappingType?: IngestionMappingKind;\n ingestionMappingKind?: IngestionMappingKind;\n additionalTags?: string;\n ingestIfNotExists?: string;\n ingestByTags?: string[];\n dropByTags?: string[];\n flushImmediately?: boolean;\n ignoreFirstRecord?: boolean;\n reportLevel?: ReportLevel;\n reportMethod?: ReportMethod;\n validationPolicy?: ValidationPolicy;\n additionalProperties?: { [additional: string]: any } | null;\n}\n\n// This trick lets us avoid duplicating all the properties from the interface. See https://github.com/microsoft/TypeScript/issues/3407\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IngestionProperties extends IngestionPropertiesFields {}\n\n// eslint-disable-next-line no-redeclare\nexport class IngestionProperties {\n constructor(data: Partial<IngestionPropertiesFields>) {\n Object.assign(this, data);\n }\n\n validate() {\n if (!this.database) throw new IngestionPropertiesValidationError(\"Must define a target database\");\n if (!this.table) throw new IngestionPropertiesValidationError(\"Must define a target table\");\n if (!this.format) throw new IngestionPropertiesValidationError(\"Must define a data format\");\n\n if (this.ingestionMappingType && !this.ingestionMappingKind) {\n this.ingestionMappingKind = this.ingestionMappingType;\n }\n\n if (this.ingestionMapping && !this.ingestionMappingColumns) {\n this.ingestionMappingColumns = this.ingestionMapping;\n }\n\n if (!this.ingestionMappingColumns && !this.ingestionMappingReference) {\n if (this.ingestionMappingKind) {\n throw new IngestionPropertiesValidationError(\n \"Cannot define ingestionMappingKind without either ingestionMappingColumns or\" + \" ingestionMappingReference\"\n );\n }\n } else {\n const mappingKind = dataFormatMappingKind(this.format);\n if (this.ingestionMappingKind && this.ingestionMappingKind !== mappingKind) {\n throw new IngestionPropertiesValidationError(\n `Mapping kind '${this.ingestionMappingKind}' does not match format '${this.format}' (should be '${mappingKind}')`\n );\n }\n if (this.ingestionMappingColumns) {\n if (this.ingestionMappingReference) {\n throw new IngestionPropertiesValidationError(\"Cannot define both ingestionMappingColumns and ingestionMappingReference\");\n }\n\n if (this.ingestionMappingColumns.length === 0) {\n throw new IngestionPropertiesValidationError(\"Must define at least one column mapping\");\n }\n\n const wrongMappings = this.ingestionMappingColumns\n .filter((m) => m.mappingKind !== mappingKind)\n .map(\n (m) => `Mapping kind mismatch for column '${m.columnName}' - expected data format kind - '${mappingKind}', but was '${m.mappingKind}'`\n );\n if (wrongMappings.length > 0) {\n throw new IngestionPropertiesValidationError(`Invalid columns:\\n${wrongMappings.join(\"\\n\")}`);\n }\n }\n }\n\n if (this.reportMethod !== ReportMethod.Queue && this.reportLevel === ReportLevel.FailuresOnly) {\n throw new IngestionPropertiesValidationError(\"ReportLevel.FailuresOnly is not supported with ReportMethod.Table\");\n }\n }\n\n merge(extraProps: IngestionPropertiesInput) {\n const merged = new IngestionProperties(this);\n\n if (!extraProps) {\n return merged;\n }\n\n const assign = <K extends keyof IngestionPropertiesFields, V extends IngestionPropertiesFields[K]>(\n obj: IngestionPropertiesFields,\n prop: K,\n value: V\n ) => {\n obj[prop] = value;\n };\n\n for (const key of Object.keys(extraProps) as (keyof IngestionPropertiesFields)[]) {\n if (extraProps[key]) {\n assign(merged, key, extraProps[key]);\n }\n }\n\n return merged;\n }\n\n setDefaults() {\n if (!this.format) {\n this.format = DataFormat.CSV;\n }\n if (!this.reportLevel) {\n this.reportLevel = ReportLevel.FailuresOnly;\n }\n if (!this.reportMethod) {\n this.reportMethod = ReportMethod.Queue;\n }\n }\n}\n\nexport type IngestionPropertiesInput = IngestionProperties | IngestionPropertiesFields | null | undefined;\n\nexport function shouldCompressFileByFormat(ingestionProperties?: IngestionPropertiesInput): boolean {\n if (!ingestionProperties) {\n ingestionProperties = {};\n }\n return !(\n ingestionProperties.format === \"avro\" ||\n ingestionProperties.format === \"parquet\" ||\n ingestionProperties.format === \"orc\" ||\n ingestionProperties.format === \"apacheavro\" ||\n ingestionProperties.format === \"sstream\"\n );\n}\n\nexport default IngestionProperties;\n"]}
|
|
1
|
+
{"version":3,"file":"ingestionProperties.js","sourceRoot":"","sources":["../../src/ingestionProperties.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAuSlC,gEAWC;AAhTD,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;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C9B,IAAO,EACP,KAAQ,EACV,EAAE;YACA,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC;QAEF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAwC,EAAE,CAAC;YAC/E,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,WAAW;QACP,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,YAAY,CAAC;QAChD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC;QAC3C,CAAC;IACL,CAAC;CACJ;AA3FD,kDA2FC;AAID,SAAgB,0BAA0B,CAAC,mBAA8C;IACrF,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvB,mBAAmB,GAAG,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,CACJ,mBAAmB,CAAC,MAAM,KAAK,MAAM;QACrC,mBAAmB,CAAC,MAAM,KAAK,SAAS;QACxC,mBAAmB,CAAC,MAAM,KAAK,KAAK;QACpC,mBAAmB,CAAC,MAAM,KAAK,YAAY;QAC3C,mBAAmB,CAAC,MAAM,KAAK,SAAS,CAC3C,CAAC;AACN,CAAC;AAED,kBAAe,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IngestionPropertiesValidationError } from \"./errors\";\nimport { ColumnMapping } from \"./columnMappings\";\n\n/**\n * Data formats supported for Kusto ingestion.\n */\nexport enum DataFormat {\n /**\n * Comma-separated value.\n */\n CSV = \"csv\",\n /**\n * Tab-separated value.\n */\n TSV = \"tsv\",\n /**\n * Semicolon-separated value (the unique Azure Storage log format).\n */\n SCSV = \"scsv\",\n /**\n * Start-Of-Header (CTRL-A)-separated value.\n */\n SOHSV = \"sohsv\",\n /**\n * Pipeline-separated value (used by Cosmos).\n */\n PSV = \"psv\",\n /**\n * Each record is a line and has just one field.\n */\n TXT = \"txt\",\n /**\n * Whole stream is a single record with a single field.\n */\n RAW = \"raw\",\n /**\n * Tab-separated value with '\\' escaping character.\n */\n TSVE = \"tsve\",\n /**\n * Data is in a JSON format, each line is record with a single JSON value.\n */\n JSON = \"json\",\n /**\n * Data stream holds a single JSON value -- newlines are regular whitespace.\n */\n SINGLEJSON = \"singlejson\",\n /**\n * The data stream is a concatenation of JSON documents (property bags all).\n */\n MULTIJSON = \"multijson\",\n /**\n * Avro format.\n */\n AVRO = \"avro\",\n /**\n * Parquet format.\n */\n PARQUET = \"parquet\",\n /**\n * Microsoft Cosmos structured streams format\n */\n SSTREAM = \"sstream\",\n /**\n * The Optimized Row Columnar (ORC)\n */\n ORC = \"orc\",\n /**\n * Avro format for ingesting through avro2json.\n */\n APACHEAVRO = \"apacheavro\",\n /**\n * W3C Extended Log File format.\n */\n W3CLogFile = \"w3clogfile\",\n}\n\nexport enum IngestionMappingKind {\n CSV = \"Csv\",\n JSON = \"Json\",\n AVRO = \"Avro\",\n PARQUET = \"Parquet\",\n SSTREAM = \"SStream\",\n ORC = \"orc\",\n APACHEAVRO = \"ApacheAvro\",\n W3CLOGFILE = \"W3CLogFile\",\n}\n\nexport const dataFormatMappingKind = (dataFormat: DataFormat): IngestionMappingKind => {\n switch (dataFormat) {\n case DataFormat.CSV:\n return IngestionMappingKind.CSV;\n case DataFormat.TSV:\n return IngestionMappingKind.CSV;\n case DataFormat.SCSV:\n return IngestionMappingKind.CSV;\n case DataFormat.SOHSV:\n return IngestionMappingKind.CSV;\n case DataFormat.PSV:\n return IngestionMappingKind.CSV;\n case DataFormat.TXT:\n return IngestionMappingKind.CSV;\n case DataFormat.RAW:\n return IngestionMappingKind.CSV;\n case DataFormat.TSVE:\n return IngestionMappingKind.CSV;\n case DataFormat.JSON:\n return IngestionMappingKind.JSON;\n case DataFormat.SINGLEJSON:\n return IngestionMappingKind.JSON;\n case DataFormat.MULTIJSON:\n return IngestionMappingKind.JSON;\n case DataFormat.AVRO:\n return IngestionMappingKind.AVRO;\n case DataFormat.PARQUET:\n return IngestionMappingKind.PARQUET;\n case DataFormat.SSTREAM:\n return IngestionMappingKind.SSTREAM;\n case DataFormat.ORC:\n return IngestionMappingKind.ORC;\n case DataFormat.APACHEAVRO:\n return IngestionMappingKind.APACHEAVRO;\n case DataFormat.W3CLogFile:\n return IngestionMappingKind.W3CLOGFILE;\n default:\n throw new IngestionPropertiesValidationError(`Unsupported data format: ${dataFormat}`);\n }\n};\n\nexport enum ValidationOptions {\n DoNotValidate = 0,\n ValidateCsvInputConstantColumns = 1,\n ValidateCsvInputColumnLevelOnly = 2,\n}\n\nexport enum ValidationImplications {\n Fail = 0,\n BestEffort = 1,\n}\n\nexport class ValidationPolicy {\n constructor(\n readonly validationOptions: ValidationOptions = ValidationOptions.DoNotValidate,\n readonly validationImplications: ValidationImplications = ValidationImplications.BestEffort\n ) {}\n\n toJSON(): Record<string, number> {\n return {\n ValidationOptions: this.validationOptions,\n ValidationImplications: this.validationImplications,\n };\n }\n}\n\nexport enum ReportLevel {\n FailuresOnly = 0,\n DoNotReport = 1,\n FailuresAndSuccesses = 2,\n}\n\nexport enum ReportMethod {\n Queue = 0,\n Table,\n QueueAndTable,\n}\n\nexport interface IngestionPropertiesFields {\n database?: string;\n table?: string;\n format?: DataFormat;\n /**\n * @deprecated. Use ingestionMappingColumns instead.\n */\n ingestionMapping?: ColumnMapping[];\n ingestionMappingColumns?: ColumnMapping[];\n ingestionMappingReference?: string;\n /**\n * @deprecated. Use ingestionMappingKind instead.\n */\n ingestionMappingType?: IngestionMappingKind;\n ingestionMappingKind?: IngestionMappingKind;\n additionalTags?: string[];\n ingestIfNotExists?: string;\n ingestByTags?: string[];\n dropByTags?: string[];\n flushImmediately?: boolean;\n ignoreFirstRecord?: boolean;\n reportLevel?: ReportLevel;\n reportMethod?: ReportMethod;\n validationPolicy?: ValidationPolicy;\n additionalProperties?: { [additional: string]: any } | null;\n}\n\n// This trick lets us avoid duplicating all the properties from the interface. See https://github.com/microsoft/TypeScript/issues/3407\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IngestionProperties extends IngestionPropertiesFields {}\n\n// eslint-disable-next-line no-redeclare\nexport class IngestionProperties {\n constructor(data: Partial<IngestionPropertiesFields>) {\n Object.assign(this, data);\n }\n\n validate() {\n if (!this.database) throw new IngestionPropertiesValidationError(\"Must define a target database\");\n if (!this.table) throw new IngestionPropertiesValidationError(\"Must define a target table\");\n if (!this.format) throw new IngestionPropertiesValidationError(\"Must define a data format\");\n\n if (this.ingestionMappingType && !this.ingestionMappingKind) {\n this.ingestionMappingKind = this.ingestionMappingType;\n }\n\n if (this.ingestionMapping && !this.ingestionMappingColumns) {\n this.ingestionMappingColumns = this.ingestionMapping;\n }\n\n if (!this.ingestionMappingColumns && !this.ingestionMappingReference) {\n if (this.ingestionMappingKind) {\n throw new IngestionPropertiesValidationError(\n \"Cannot define ingestionMappingKind without either ingestionMappingColumns or\" + \" ingestionMappingReference\"\n );\n }\n } else {\n const mappingKind = dataFormatMappingKind(this.format);\n if (this.ingestionMappingKind && this.ingestionMappingKind !== mappingKind) {\n throw new IngestionPropertiesValidationError(\n `Mapping kind '${this.ingestionMappingKind}' does not match format '${this.format}' (should be '${mappingKind}')`\n );\n }\n if (this.ingestionMappingColumns) {\n if (this.ingestionMappingReference) {\n throw new IngestionPropertiesValidationError(\"Cannot define both ingestionMappingColumns and ingestionMappingReference\");\n }\n\n if (this.ingestionMappingColumns.length === 0) {\n throw new IngestionPropertiesValidationError(\"Must define at least one column mapping\");\n }\n\n const wrongMappings = this.ingestionMappingColumns\n .filter((m) => m.mappingKind !== mappingKind)\n .map(\n (m) => `Mapping kind mismatch for column '${m.columnName}' - expected data format kind - '${mappingKind}', but was '${m.mappingKind}'`\n );\n if (wrongMappings.length > 0) {\n throw new IngestionPropertiesValidationError(`Invalid columns:\\n${wrongMappings.join(\"\\n\")}`);\n }\n }\n }\n\n if (this.reportMethod !== ReportMethod.Queue && this.reportLevel === ReportLevel.FailuresOnly) {\n throw new IngestionPropertiesValidationError(\"ReportLevel.FailuresOnly is not supported with ReportMethod.Table\");\n }\n }\n\n merge(extraProps: IngestionPropertiesInput) {\n const merged = new IngestionProperties(this);\n\n if (!extraProps) {\n return merged;\n }\n\n const assign = <K extends keyof IngestionPropertiesFields, V extends IngestionPropertiesFields[K]>(\n obj: IngestionPropertiesFields,\n prop: K,\n value: V\n ) => {\n obj[prop] = value;\n };\n\n for (const key of Object.keys(extraProps) as (keyof IngestionPropertiesFields)[]) {\n if (extraProps[key]) {\n assign(merged, key, extraProps[key]);\n }\n }\n\n return merged;\n }\n\n setDefaults() {\n if (!this.format) {\n this.format = DataFormat.CSV;\n }\n if (!this.reportLevel) {\n this.reportLevel = ReportLevel.FailuresOnly;\n }\n if (!this.reportMethod) {\n this.reportMethod = ReportMethod.Queue;\n }\n }\n}\n\nexport type IngestionPropertiesInput = IngestionProperties | IngestionPropertiesFields | null | undefined;\n\nexport function shouldCompressFileByFormat(ingestionProperties?: IngestionPropertiesInput): boolean {\n if (!ingestionProperties) {\n ingestionProperties = {};\n }\n return !(\n ingestionProperties.format === \"avro\" ||\n ingestionProperties.format === \"parquet\" ||\n ingestionProperties.format === \"orc\" ||\n ingestionProperties.format === \"apacheavro\" ||\n ingestionProperties.format === \"sstream\"\n );\n}\n\nexport default IngestionProperties;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-kusto-ingest",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
4
4
|
"description": "Azure Data Explorer Ingestion SDK",
|
|
5
5
|
"module": "dist-esm/src/index.js",
|
|
6
6
|
"types": "./types/src/index.d.ts",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@types/tmp": "^0.2.3",
|
|
65
65
|
"@types/uuid": "^8.3.4",
|
|
66
66
|
"@types/uuid-validate": "0.0.1",
|
|
67
|
-
"azure-kusto-data": "^6.0.
|
|
67
|
+
"azure-kusto-data": "^6.0.4",
|
|
68
68
|
"browserify-zlib": "0.2.0",
|
|
69
69
|
"buffer": "^6.0.3",
|
|
70
70
|
"is-ip": "^3.1.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"@types/sinon": "^10.0.13",
|
|
80
80
|
"assert": "^2.0.0"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "4565fc653a00ec6827d25df814dc9153b009025d"
|
|
83
83
|
}
|
|
@@ -123,7 +123,7 @@ export interface IngestionPropertiesFields {
|
|
|
123
123
|
*/
|
|
124
124
|
ingestionMappingType?: IngestionMappingKind;
|
|
125
125
|
ingestionMappingKind?: IngestionMappingKind;
|
|
126
|
-
additionalTags?: string;
|
|
126
|
+
additionalTags?: string[];
|
|
127
127
|
ingestIfNotExists?: string;
|
|
128
128
|
ingestByTags?: string[];
|
|
129
129
|
dropByTags?: string[];
|