azure-kusto-ingest 7.0.0-alpha.2 → 7.0.0-alpha.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.
- package/dist-esm/src/statusQ.js +1 -1
- package/dist-esm/src/statusQ.js.map +1 -1
- package/dist-esm/src/streamingIngestClient.browser.js +1 -1
- package/dist-esm/src/streamingIngestClient.browser.js.map +1 -1
- package/dist-esm/src/streamingIngestClient.js +1 -1
- package/dist-esm/src/streamingIngestClient.js.map +1 -1
- package/package.json +5 -5
package/dist-esm/src/statusQ.js
CHANGED
|
@@ -80,7 +80,7 @@ export class StatusQueue {
|
|
|
80
80
|
const nonEmptyQs = [];
|
|
81
81
|
const result = [];
|
|
82
82
|
for (const q of qs) {
|
|
83
|
-
const response = await q.service.receiveMessages({
|
|
83
|
+
const response = await q.service.receiveMessages({ numberOfMessages: n });
|
|
84
84
|
const messages = response.receivedMessageItems;
|
|
85
85
|
for (const m of messages) {
|
|
86
86
|
if (m && Object.keys(m).length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusQ.js","sourceRoot":"","sources":["../../src/statusQ.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAqB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAItE,MAAM,YAAY;IACd,YACa,IAAY,EACZ,OAAoB;QADpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAa;IAC9B,CAAC;CACP;AAED,MAAM,OAAO,GAAG,CAAI,CAAM,EAAO,EAAE;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;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AC,CAAC;QAC1D,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,OAAO,CAAC,MAAM,CAAC;QAC1B,CAAC;QAED,MAAM,iBAAiB,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QAEpD,2FAA2F;QAC3F,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAA,OAAO,CAAC,MAAM,CAAC,UAAU,mCAAI,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAC3F,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;CACJ","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PeekedMessageItem, QueueClient } from \"@azure/storage-queue\";\nimport { ResourceURI } from \"./resourceManager.js\";\nimport { StatusMessage } from \"./status.js\";\n\nclass QueueDetails {\n constructor(\n readonly name: string,\n readonly service: QueueClient,\n ) {}\n}\n\nconst shuffle = <T>(a: T[]): T[] => {\n for (let i = a.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const temp = a[j];\n a[j] = a[i];\n a[i] = temp;\n }\n\n return a;\n};\n\ninterface PeekParams {\n raw: boolean;\n}\n\ninterface PopParams {\n raw: boolean;\n remove: boolean;\n}\n\ntype Message = PeekedMessageItem | StatusMessage;\n\nexport class StatusQueue {\n constructor(\n readonly getQueuesFunc: () => Promise<ResourceURI[]>,\n readonly messageCls: typeof StatusMessage,\n ) {}\n\n _getQServices(queuesDetails: ResourceURI[]) {\n return queuesDetails.map((q) => {\n const fullUri = q.uri;\n if (!fullUri) {\n throw new Error(\"Empty or null connection string\");\n }\n // chop off sas\n const indexOfSas = q.uri.indexOf(\"?\");\n const name = indexOfSas > 0 ? q.uri.substring(0, indexOfSas) : q.uri;\n return new QueueDetails(name, new QueueClient(fullUri));\n });\n }\n\n async isEmpty() {\n const result = await this.peek(1, { raw: true });\n return !result || result.length === 0;\n }\n\n decodeContent(content: string) {\n return Buffer.from(content, \"base64\").toString(\"ascii\");\n }\n\n deserializeMessage(m: PeekedMessageItem): StatusMessage {\n return new this.messageCls(this.decodeContent(m.messageText), null, null);\n }\n\n async _peek(qs: QueueDetails[], n: number, options: PeekParams | null): Promise<{ result: Message[]; nonEmptyQs: QueueDetails[]; done: boolean }> {\n const result: Message[] = [];\n const nonEmptyQs: QueueDetails[] = [];\n\n for (const q of qs) {\n const response = await q.service.peekMessages();\n const messages = response.peekedMessageItems;\n\n if (messages && messages.length > 0) {\n nonEmptyQs.push(q);\n }\n\n for (const m of messages) {\n if (m && Object.keys(m).length > 0) {\n result.push(options && options.raw ? m : this.deserializeMessage(m));\n\n if (result.length === n) {\n return { done: true, nonEmptyQs, result };\n }\n }\n }\n }\n return { done: nonEmptyQs.length === 0, nonEmptyQs, result };\n }\n\n async peek(n = 1, options: PeekParams | null = null): Promise<Message[]> {\n const queues = await this.getQueuesFunc();\n const qServices: QueueDetails[] = shuffle(this._getQServices(queues));\n const perQ = qServices.length > 1 ? Math.floor(n / qServices.length) : qServices.length;\n\n // First, iterate evenly and randomly on status queues\n const partial = await this._peek(qServices, perQ, options);\n\n if (partial.done) {\n return partial.result;\n }\n const messagesLeftToPeek = n - partial.result.length;\n\n // In case queues are uneven, iterate again. This time, request for all n messages and trim\n return (await this._peek(partial.nonEmptyQs, messagesLeftToPeek, options)).result;\n }\n\n async _pop(\n qs: QueueDetails[],\n n: number,\n options: PopParams | null,\n ): Promise<{ result: Message[] & { nonEmptyQs?: QueueDetails[] }; nonEmptyQs: any[]; done: boolean }> {\n const nonEmptyQs: any[] = [];\n const result = [];\n\n for (const q of qs) {\n const response = await q.service.receiveMessages({ numOfMessages: n });\n const messages = response.receivedMessageItems;\n for (const m of messages) {\n if (m && Object.keys(m).length > 0) {\n result.push(options && options.raw ? m : this.deserializeMessage(m));\n\n if (!(options && !options.remove)) {\n await q.service.deleteMessage(m.messageId, m.popReceipt);\n }\n if (result.length === n) {\n return { done: true, nonEmptyQs, result };\n }\n }\n }\n }\n\n return { done: nonEmptyQs.length === 0, nonEmptyQs, result };\n }\n\n async pop(n = 1, options: PopParams | null = null): Promise<Message[]> {\n const queues = await this.getQueuesFunc();\n const qServices = shuffle(this._getQServices(queues));\n const perQ = qServices.length > 1 ? Math.floor(n / qServices.length) : qServices.length;\n\n // First, iterate evenly and randomly on status queues\n const partial = await this._pop(qServices, perQ, options);\n if (partial.done) {\n return partial.result;\n }\n\n const messagesLeftToPop = n - partial.result.length;\n\n // In case queues are uneven, iterate again. This time, request for all n messages and trim\n const final = await this._pop(partial.result.nonEmptyQs ?? [], messagesLeftToPop, options);\n return partial.result.concat(final.result);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"statusQ.js","sourceRoot":"","sources":["../../src/statusQ.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAqB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAItE,MAAM,YAAY;IACd,YACa,IAAY,EACZ,OAAoB;QADpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAa;IAC9B,CAAC;CACP;AAED,MAAM,OAAO,GAAG,CAAI,CAAM,EAAO,EAAE;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAA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C3F,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAA,OAAO,CAAC,MAAM,CAAC,UAAU,mCAAI,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAC3F,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;CACJ","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PeekedMessageItem, QueueClient } from \"@azure/storage-queue\";\nimport { ResourceURI } from \"./resourceManager.js\";\nimport { StatusMessage } from \"./status.js\";\n\nclass QueueDetails {\n constructor(\n readonly name: string,\n readonly service: QueueClient,\n ) {}\n}\n\nconst shuffle = <T>(a: T[]): T[] => {\n for (let i = a.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const temp = a[j];\n a[j] = a[i];\n a[i] = temp;\n }\n\n return a;\n};\n\ninterface PeekParams {\n raw: boolean;\n}\n\ninterface PopParams {\n raw: boolean;\n remove: boolean;\n}\n\ntype Message = PeekedMessageItem | StatusMessage;\n\nexport class StatusQueue {\n constructor(\n readonly getQueuesFunc: () => Promise<ResourceURI[]>,\n readonly messageCls: typeof StatusMessage,\n ) {}\n\n _getQServices(queuesDetails: ResourceURI[]) {\n return queuesDetails.map((q) => {\n const fullUri = q.uri;\n if (!fullUri) {\n throw new Error(\"Empty or null connection string\");\n }\n // chop off sas\n const indexOfSas = q.uri.indexOf(\"?\");\n const name = indexOfSas > 0 ? q.uri.substring(0, indexOfSas) : q.uri;\n return new QueueDetails(name, new QueueClient(fullUri));\n });\n }\n\n async isEmpty() {\n const result = await this.peek(1, { raw: true });\n return !result || result.length === 0;\n }\n\n decodeContent(content: string) {\n return Buffer.from(content, \"base64\").toString(\"ascii\");\n }\n\n deserializeMessage(m: PeekedMessageItem): StatusMessage {\n return new this.messageCls(this.decodeContent(m.messageText), null, null);\n }\n\n async _peek(qs: QueueDetails[], n: number, options: PeekParams | null): Promise<{ result: Message[]; nonEmptyQs: QueueDetails[]; done: boolean }> {\n const result: Message[] = [];\n const nonEmptyQs: QueueDetails[] = [];\n\n for (const q of qs) {\n const response = await q.service.peekMessages();\n const messages = response.peekedMessageItems;\n\n if (messages && messages.length > 0) {\n nonEmptyQs.push(q);\n }\n\n for (const m of messages) {\n if (m && Object.keys(m).length > 0) {\n result.push(options && options.raw ? m : this.deserializeMessage(m));\n\n if (result.length === n) {\n return { done: true, nonEmptyQs, result };\n }\n }\n }\n }\n return { done: nonEmptyQs.length === 0, nonEmptyQs, result };\n }\n\n async peek(n = 1, options: PeekParams | null = null): Promise<Message[]> {\n const queues = await this.getQueuesFunc();\n const qServices: QueueDetails[] = shuffle(this._getQServices(queues));\n const perQ = qServices.length > 1 ? Math.floor(n / qServices.length) : qServices.length;\n\n // First, iterate evenly and randomly on status queues\n const partial = await this._peek(qServices, perQ, options);\n\n if (partial.done) {\n return partial.result;\n }\n const messagesLeftToPeek = n - partial.result.length;\n\n // In case queues are uneven, iterate again. This time, request for all n messages and trim\n return (await this._peek(partial.nonEmptyQs, messagesLeftToPeek, options)).result;\n }\n\n async _pop(\n qs: QueueDetails[],\n n: number,\n options: PopParams | null,\n ): Promise<{ result: Message[] & { nonEmptyQs?: QueueDetails[] }; nonEmptyQs: any[]; done: boolean }> {\n const nonEmptyQs: any[] = [];\n const result = [];\n\n for (const q of qs) {\n const response = await q.service.receiveMessages({ numberOfMessages: n });\n const messages = response.receivedMessageItems;\n for (const m of messages) {\n if (m && Object.keys(m).length > 0) {\n result.push(options && options.raw ? m : this.deserializeMessage(m));\n\n if (!(options && !options.remove)) {\n await q.service.deleteMessage(m.messageId, m.popReceipt);\n }\n if (result.length === n) {\n return { done: true, nonEmptyQs, result };\n }\n }\n }\n }\n\n return { done: nonEmptyQs.length === 0, nonEmptyQs, result };\n }\n\n async pop(n = 1, options: PopParams | null = null): Promise<Message[]> {\n const queues = await this.getQueuesFunc();\n const qServices = shuffle(this._getQServices(queues));\n const perQ = qServices.length > 1 ? Math.floor(n / qServices.length) : qServices.length;\n\n // First, iterate evenly and randomly on status queues\n const partial = await this._pop(qServices, perQ, options);\n if (partial.done) {\n return partial.result;\n }\n\n const messagesLeftToPop = n - partial.result.length;\n\n // In case queues are uneven, iterate again. This time, request for all n messages and trim\n const final = await this._pop(partial.result.nonEmptyQs ?? [], messagesLeftToPop, options);\n return partial.result.concat(final.result);\n }\n}\n"]}
|
|
@@ -16,7 +16,7 @@ class KustoStreamingIngestClient extends KustoStreamingIngestClientBase {
|
|
|
16
16
|
this.ensureOpen();
|
|
17
17
|
const props = this._getMergedProps(ingestionProperties);
|
|
18
18
|
const descriptor = stream instanceof StreamDescriptor ? stream : new StreamDescriptor(stream);
|
|
19
|
-
return await this.kustoClient.executeStreamingIngest(props.database, props.table, descriptor.stream, props.format, (_a = props.ingestionMappingReference) !== null && _a !== void 0 ? _a : null, clientRequestId);
|
|
19
|
+
return await this.kustoClient.executeStreamingIngest(props.database, props.table, descriptor.stream, props.format, (_a = props.ingestionMappingReference) !== null && _a !== void 0 ? _a : null, undefined, clientRequestId);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Use string for Node.js and Blob in browser
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamingIngestClient.browser.js","sourceRoot":"","sources":["../../src/streamingIngestClient.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAEhF,MAAM,0BAA2B,SAAQ,8BAA8B;IACnE,YAAY,IAA2C,EAAE,YAAuC,EAAE,mBAA6B;QAC3H,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAAsC,EAAE,mBAA8C,EAAE,eAAwB;;QACnI,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;QACxD,MAAM,UAAU,GAAqB,MAAM,YAAY,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAChH,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAChD,KAAK,CAAC,QAAkB,EACxB,KAAK,CAAC,KAAe,EACrB,UAAU,CAAC,MAAM,EACjB,KAAK,CAAC,MAAM,EACZ,MAAA,KAAK,CAAC,yBAAyB,mCAAI,IAAI,EACvC,eAAe,CAClB,CAAC;IACN,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,IAA2B,EAAE,mBAA8C;QAC5F,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,UAAU,GAAmB,IAAI,YAAY,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;QACpG,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,eAAe,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACzF,CAAC;CACJ;AAED,eAAe,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IngestionPropertiesInput } from \"./ingestionProperties.js\";\n\nimport { KustoConnectionStringBuilder, KustoResponseDataSet } from \"azure-kusto-data\";\nimport { StreamDescriptor } from \"./descriptors.js\";\nimport { FileDescriptor } from \"./fileDescriptor.browser.js\";\nimport { tryFileToBuffer } from \"./streamUtils.browser.js\";\nimport { KustoStreamingIngestClientBase } from \"./streamingIngestClientBase.js\";\n\nclass KustoStreamingIngestClient extends KustoStreamingIngestClientBase {\n constructor(kcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput, autoCorrectEndpoint?: boolean) {\n super(kcsb, defaultProps, autoCorrectEndpoint);\n }\n\n /**\n * Use Readable for Node.js and ArrayBuffer in browser\n */\n async ingestFromStream(stream: StreamDescriptor | ArrayBuffer, ingestionProperties?: IngestionPropertiesInput, clientRequestId?: string): Promise<any> {\n this.ensureOpen();\n\n const props = this._getMergedProps(ingestionProperties);\n const descriptor: StreamDescriptor = stream instanceof StreamDescriptor ? stream : new StreamDescriptor(stream);\n return await this.kustoClient.executeStreamingIngest(\n props.database as string,\n props.table as string,\n descriptor.stream,\n props.format,\n props.ingestionMappingReference ?? null,\n clientRequestId,\n );\n }\n\n /**\n * Use string for Node.js and Blob in browser\n */\n async ingestFromFile(file: FileDescriptor | Blob, ingestionProperties?: IngestionPropertiesInput): Promise<KustoResponseDataSet> {\n this.ensureOpen();\n\n const descriptor: FileDescriptor = file instanceof FileDescriptor ? file : new FileDescriptor(file);\n return this.ingestFromStream(await tryFileToBuffer(descriptor), ingestionProperties);\n }\n}\n\nexport default KustoStreamingIngestClient;\n"]}
|
|
1
|
+
{"version":3,"file":"streamingIngestClient.browser.js","sourceRoot":"","sources":["../../src/streamingIngestClient.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAEhF,MAAM,0BAA2B,SAAQ,8BAA8B;IACnE,YAAY,IAA2C,EAAE,YAAuC,EAAE,mBAA6B;QAC3H,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAAsC,EAAE,mBAA8C,EAAE,eAAwB;;QACnI,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;QACxD,MAAM,UAAU,GAAqB,MAAM,YAAY,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAChH,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAChD,KAAK,CAAC,QAAkB,EACxB,KAAK,CAAC,KAAe,EACrB,UAAU,CAAC,MAAM,EACjB,KAAK,CAAC,MAAM,EACZ,MAAA,KAAK,CAAC,yBAAyB,mCAAI,IAAI,EACvC,SAAS,EACT,eAAe,CAClB,CAAC;IACN,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,IAA2B,EAAE,mBAA8C;QAC5F,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,UAAU,GAAmB,IAAI,YAAY,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;QACpG,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,eAAe,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACzF,CAAC;CACJ;AAED,eAAe,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IngestionPropertiesInput } from \"./ingestionProperties.js\";\n\nimport { KustoConnectionStringBuilder, KustoResponseDataSet } from \"azure-kusto-data\";\nimport { StreamDescriptor } from \"./descriptors.js\";\nimport { FileDescriptor } from \"./fileDescriptor.browser.js\";\nimport { tryFileToBuffer } from \"./streamUtils.browser.js\";\nimport { KustoStreamingIngestClientBase } from \"./streamingIngestClientBase.js\";\n\nclass KustoStreamingIngestClient extends KustoStreamingIngestClientBase {\n constructor(kcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput, autoCorrectEndpoint?: boolean) {\n super(kcsb, defaultProps, autoCorrectEndpoint);\n }\n\n /**\n * Use Readable for Node.js and ArrayBuffer in browser\n */\n async ingestFromStream(stream: StreamDescriptor | ArrayBuffer, ingestionProperties?: IngestionPropertiesInput, clientRequestId?: string): Promise<any> {\n this.ensureOpen();\n\n const props = this._getMergedProps(ingestionProperties);\n const descriptor: StreamDescriptor = stream instanceof StreamDescriptor ? stream : new StreamDescriptor(stream);\n return await this.kustoClient.executeStreamingIngest(\n props.database as string,\n props.table as string,\n descriptor.stream,\n props.format,\n props.ingestionMappingReference ?? null,\n undefined,\n clientRequestId,\n );\n }\n\n /**\n * Use string for Node.js and Blob in browser\n */\n async ingestFromFile(file: FileDescriptor | Blob, ingestionProperties?: IngestionPropertiesInput): Promise<KustoResponseDataSet> {\n this.ensureOpen();\n\n const descriptor: FileDescriptor = file instanceof FileDescriptor ? file : new FileDescriptor(file);\n return this.ingestFromStream(await tryFileToBuffer(descriptor), ingestionProperties);\n }\n}\n\nexport default KustoStreamingIngestClient;\n"]}
|
|
@@ -22,7 +22,7 @@ class KustoStreamingIngestClient extends KustoStreamingIngestClientBase {
|
|
|
22
22
|
? descriptor.stream.pipe(zlib.createGzip())
|
|
23
23
|
: descriptor.stream
|
|
24
24
|
: descriptor.stream;
|
|
25
|
-
return await this.kustoClient.executeStreamingIngest(props.database, props.table, compressedStream, props.format, (_a = props.ingestionMappingReference) !== null && _a !== void 0 ? _a : null, clientRequestId);
|
|
25
|
+
return await this.kustoClient.executeStreamingIngest(props.database, props.table, compressedStream, props.format, (_a = props.ingestionMappingReference) !== null && _a !== void 0 ? _a : null, undefined, clientRequestId);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Use string for Node.js and Blob in browser
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamingIngestClient.js","sourceRoot":"","s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AAM,EACZ,MAAA,KAAK,CAAC,yBAAyB,mCAAI,IAAI,EACvC,eAAe,CAClB,CAAC;IACN,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,IAAoC,EAAE,mBAA8C;QACrG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,UAAU,GAAmB,IAAI,YAAY,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;QACpG,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,YAAY,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACtF,CAAC;CACJ;AAED,eAAe,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IngestionPropertiesInput } from \"./ingestionProperties.js\";\n\nimport { KustoConnectionStringBuilder, KustoResponseDataSet } from \"azure-kusto-data\";\nimport { Readable } from \"stream\";\nimport zlib from \"zlib\";\nimport { CompressionType, StreamDescriptor } from \"./descriptors.js\";\nimport { FileDescriptor } from \"./fileDescriptor.js\";\nimport { fileToStream } from \"./streamUtils.js\";\nimport { KustoStreamingIngestClientBase } from \"./streamingIngestClientBase.js\";\n\nclass KustoStreamingIngestClient extends KustoStreamingIngestClientBase {\n constructor(kcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput, autoCorrectEndpoint?: boolean) {\n super(kcsb, defaultProps, autoCorrectEndpoint);\n }\n\n /**\n * Use Readable for Node.js and ArrayBuffer in browser\n */\n async ingestFromStream(\n stream: StreamDescriptor | Readable | ArrayBuffer,\n ingestionProperties?: IngestionPropertiesInput,\n clientRequestId?: string,\n ): Promise<any> {\n this.ensureOpen();\n\n const props = this._getMergedProps(ingestionProperties);\n const descriptor: StreamDescriptor = stream instanceof StreamDescriptor ? stream : new StreamDescriptor(stream);\n\n const compressedStream =\n descriptor.compressionType === CompressionType.None\n ? !(descriptor.stream instanceof ArrayBuffer)\n ? descriptor.stream.pipe(zlib.createGzip())\n : descriptor.stream\n : descriptor.stream;\n return await this.kustoClient.executeStreamingIngest(\n props.database as string,\n props.table as string,\n compressedStream,\n props.format,\n props.ingestionMappingReference ?? null,\n clientRequestId,\n );\n }\n\n /**\n * Use string for Node.js and Blob in browser\n */\n async ingestFromFile(file: FileDescriptor | string | Blob, ingestionProperties?: IngestionPropertiesInput): Promise<KustoResponseDataSet> {\n this.ensureOpen();\n\n const descriptor: FileDescriptor = file instanceof FileDescriptor ? file : new FileDescriptor(file);\n return this.ingestFromStream(await fileToStream(descriptor), ingestionProperties);\n }\n}\n\nexport default KustoStreamingIngestClient;\n"]}
|
|
1
|
+
{"version":3,"file":"streamingIngestClient.js","sourceRoot":"","sources":["../../src/streamingIngestClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAEhF,MAAM,0BAA2B,SAAQ,8BAA8B;IACnE,YAAY,IAA2C,EAAE,YAAuC,EAAE,mBAA6B;QAC3H,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAClB,MAAiD,EACjD,mBAA8C,EAC9C,eAAwB;;QAExB,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;QACxD,MAAM,UAAU,GAAqB,MAAM,YAAY,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAEhH,MAAM,gBAAgB,GAClB,UAAU,CAAC,eAAe,KAAK,eAAe,CAAC,IAAI;YAC/C,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,YAAY,WAAW,CAAC;gBACzC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBAC3C,CAAC,CAAC,UAAU,CAAC,MAAM;YACvB,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QAC5B,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAChD,KAAK,CAAC,QAAkB,EACxB,KAAK,CAAC,KAAe,EACrB,gBAAgB,EAChB,KAAK,CAAC,MAAM,EACZ,MAAA,KAAK,CAAC,yBAAyB,mCAAI,IAAI,EACvC,SAAS,EACT,eAAe,CAClB,CAAC;IACN,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,IAAoC,EAAE,mBAA8C;QACrG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,UAAU,GAAmB,IAAI,YAAY,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;QACpG,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,YAAY,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACtF,CAAC;CACJ;AAED,eAAe,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IngestionPropertiesInput } from \"./ingestionProperties.js\";\n\nimport { KustoConnectionStringBuilder, KustoResponseDataSet } from \"azure-kusto-data\";\nimport { Readable } from \"stream\";\nimport zlib from \"zlib\";\nimport { CompressionType, StreamDescriptor } from \"./descriptors.js\";\nimport { FileDescriptor } from \"./fileDescriptor.js\";\nimport { fileToStream } from \"./streamUtils.js\";\nimport { KustoStreamingIngestClientBase } from \"./streamingIngestClientBase.js\";\n\nclass KustoStreamingIngestClient extends KustoStreamingIngestClientBase {\n constructor(kcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput, autoCorrectEndpoint?: boolean) {\n super(kcsb, defaultProps, autoCorrectEndpoint);\n }\n\n /**\n * Use Readable for Node.js and ArrayBuffer in browser\n */\n async ingestFromStream(\n stream: StreamDescriptor | Readable | ArrayBuffer,\n ingestionProperties?: IngestionPropertiesInput,\n clientRequestId?: string,\n ): Promise<any> {\n this.ensureOpen();\n\n const props = this._getMergedProps(ingestionProperties);\n const descriptor: StreamDescriptor = stream instanceof StreamDescriptor ? stream : new StreamDescriptor(stream);\n\n const compressedStream =\n descriptor.compressionType === CompressionType.None\n ? !(descriptor.stream instanceof ArrayBuffer)\n ? descriptor.stream.pipe(zlib.createGzip())\n : descriptor.stream\n : descriptor.stream;\n return await this.kustoClient.executeStreamingIngest(\n props.database as string,\n props.table as string,\n compressedStream,\n props.format,\n props.ingestionMappingReference ?? null,\n undefined,\n clientRequestId,\n );\n }\n\n /**\n * Use string for Node.js and Blob in browser\n */\n async ingestFromFile(file: FileDescriptor | string | Blob, ingestionProperties?: IngestionPropertiesInput): Promise<KustoResponseDataSet> {\n this.ensureOpen();\n\n const descriptor: FileDescriptor = file instanceof FileDescriptor ? file : new FileDescriptor(file);\n return this.ingestFromStream(await fileToStream(descriptor), ingestionProperties);\n }\n}\n\nexport default KustoStreamingIngestClient;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-kusto-ingest",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.4",
|
|
4
4
|
"description": "Azure Data Explorer Ingestion SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist-esm/src/index.js",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@azure/data-tables": "^13.2.2",
|
|
64
|
-
"@azure/storage-blob": "^12.
|
|
65
|
-
"@azure/storage-queue": "^12.
|
|
64
|
+
"@azure/storage-blob": "^12.26.0",
|
|
65
|
+
"@azure/storage-queue": "^12.25.0",
|
|
66
66
|
"@types/jsbn": "^1.2.33",
|
|
67
67
|
"@types/pako": "^2.0.0",
|
|
68
68
|
"@types/stream-array": "^1.1.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@types/tmp": "^0.2.3",
|
|
71
71
|
"@types/uuid": "^8.3.4",
|
|
72
72
|
"@types/uuid-validate": "0.0.1",
|
|
73
|
-
"azure-kusto-data": "^7.0.0-alpha.
|
|
73
|
+
"azure-kusto-data": "^7.0.0-alpha.4",
|
|
74
74
|
"browserify-zlib": "0.2.0",
|
|
75
75
|
"buffer": "^6.0.3",
|
|
76
76
|
"is-ip": "^3.1.0",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"@types/sinon": "^10.0.13",
|
|
86
86
|
"assert": "^2.0.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "daa0e1b73e76aedbdfae921526ec55087f1fb646"
|
|
89
89
|
}
|