Move to new "nodenext" module type (#318)

* Change type to module + proper exports

* Add azure-kusto-data path

* Change module to nodenext

* Added fallback for webpack

* prettier

* Linting

* jest config

* jest config

* jest config

* try to fix dirname

* try to fix dirname

* Very hacky but we'll try

* Remove browser tests

* Remove browser tests

* Remove browser tests

* Remove browser tests

* hol up

* Fix assertion

* tests todos

* format

* try

* try

* try

* import style

* restore test

* restore test

* Separate browser unit tests to data and ingest

* Try different error printing

* Restore test

* Restore test

* Try to solve error

* Clarifying comments

* What happens if we do lint test files?

* try removing process/browser

* try removing process/browser
This commit is contained in:
AsafMah 2024-09-16 10:44:27 +03:00 коммит произвёл GitHub
Родитель 8fc8270ce1
Коммит a45a43029e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
60 изменённых файлов: 300 добавлений и 281 удалений

Просмотреть файл

@ -4,3 +4,5 @@ node_modules
coverage
.nyc_output
jest.config.ts
# Don't lint example files
packages/quick_start

3
.github/workflows/build.yml поставляемый
Просмотреть файл

@ -26,6 +26,7 @@ jobs:
package-lock.json
- run: npm ci
- run: npm run checkFormat
continue-on-error: true
- run: npm run lint
- name: Azure login
uses: azure/login@v2
@ -42,6 +43,8 @@ jobs:
DM_CONNECTION_STRING: "https://ingest-sdkse2etest.eastus.kusto.windows.net"
AZURE_CLIENT_ID: ${{ secrets.APP_ID }}
AZURE_TENANT_ID: ${{ secrets.TENANT_ID }}
# Required for running tests when using ESM, see https://kulshekhar.github.io/ts-jest/docs/guides/esm-support
NODE_OPTIONS: "--experimental-vm-modules"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
- name: Publish Unit Test Results

Просмотреть файл

@ -3,9 +3,17 @@
import { Config } from "jest";
import type { JestConfigWithTsJest } from "ts-jest";
import { createDefaultEsmPreset } from "ts-jest";
// Note that this preset and the moduleNameMapper are necessary to run test with ecmascript modules.
// See https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
const defaultEsmPreset = createDefaultEsmPreset();
const baseConfig: Config = {
preset: "ts-jest",
...defaultEsmPreset,
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
testEnvironment: "node",
prettierPath: "prettier",
maxWorkers: 200,

72
package-lock.json сгенерированный
Просмотреть файл

@ -10,7 +10,7 @@
"packages/azure-kusto-ingest"
],
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/jest": "^29.5.12",
"@types/node": "^18.0.0",
"@types/webpack-dev-server": "^4.7.2",
"@typescript-eslint/eslint-plugin": "^5.32.0",
@ -20,8 +20,8 @@
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-jsdoc": "^39.3.4",
"eslint-plugin-prefer-arrow": "^1.2.3",
"jest": "^29.5.0",
"jest-junit": "^15.0.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"lerna": "^7.4.2",
"npm": "^9.6.2",
"prettier": "^2.8.4",
@ -29,7 +29,7 @@
"shx": "^0.3.4",
"sinon": "^14.0.0",
"stream-browserify": "^3.0.0",
"ts-jest": "^29.1.1",
"ts-jest": "^29.2.5",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.0",
@ -3278,9 +3278,9 @@
}
},
"node_modules/@types/jest": {
"version": "29.5.7",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.7.tgz",
"integrity": "sha512-HLyetab6KVPSiF+7pFcUyMeLsx25LDNDemw9mGsJBkai/oouwrjTycocSDYopMEwFhN2Y4s9oPyOCZNofgSt2g==",
"version": "29.5.12",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz",
"integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==",
"dev": true,
"dependencies": {
"expect": "^29.0.0",
@ -8495,9 +8495,9 @@
}
},
"node_modules/jest-junit": {
"version": "15.0.0",
"resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-15.0.0.tgz",
"integrity": "sha512-Z5sVX0Ag3HZdMUnD5DFlG+1gciIFSy7yIVPhOdGUi8YJaI9iLvvBb530gtQL2CHmv0JJeiwRZenr0VrSR7frvg==",
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-16.0.0.tgz",
"integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==",
"dev": true,
"dependencies": {
"mkdirp": "^1.0.4",
@ -13667,7 +13667,7 @@
"inBundle": true,
"license": "MIT",
"dependencies": {
"ip": "^2.0.1",
"ip": "^2.0.0",
"smart-buffer": "^4.2.0"
},
"engines": {
@ -16010,12 +16010,9 @@
}
},
"node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dependencies": {
"lru-cache": "^6.0.0"
},
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
"bin": {
"semver": "bin/semver.js"
},
@ -16023,22 +16020,6 @@
"node": ">=10"
}
},
"node_modules/semver/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/semver/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/send": {
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
@ -17382,28 +17363,30 @@
}
},
"node_modules/ts-jest": {
"version": "29.1.1",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz",
"integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==",
"version": "29.2.5",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.5.tgz",
"integrity": "sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==",
"dev": true,
"dependencies": {
"bs-logger": "0.x",
"fast-json-stable-stringify": "2.x",
"bs-logger": "^0.2.6",
"ejs": "^3.1.10",
"fast-json-stable-stringify": "^2.1.0",
"jest-util": "^29.0.0",
"json5": "^2.2.3",
"lodash.memoize": "4.x",
"make-error": "1.x",
"semver": "^7.5.3",
"yargs-parser": "^21.0.1"
"lodash.memoize": "^4.1.2",
"make-error": "^1.3.6",
"semver": "^7.6.3",
"yargs-parser": "^21.1.1"
},
"bin": {
"ts-jest": "cli.js"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
"node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"
},
"peerDependencies": {
"@babel/core": ">=7.0.0-beta.0 <8",
"@jest/transform": "^29.0.0",
"@jest/types": "^29.0.0",
"babel-jest": "^29.0.0",
"jest": "^29.0.0",
@ -17413,6 +17396,9 @@
"@babel/core": {
"optional": true
},
"@jest/transform": {
"optional": true
},
"@jest/types": {
"optional": true
},

Просмотреть файл

@ -26,7 +26,7 @@
"watch": "lerna exec --stream --parallel -- tsc -b -w"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/jest": "^29.5.12",
"@types/node": "^18.0.0",
"@types/webpack-dev-server": "^4.7.2",
"@typescript-eslint/eslint-plugin": "^5.32.0",
@ -36,8 +36,8 @@
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-jsdoc": "^39.3.4",
"eslint-plugin-prefer-arrow": "^1.2.3",
"jest": "^29.5.0",
"jest-junit": "^15.0.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"lerna": "^7.4.2",
"npm": "^9.6.2",
"prettier": "^2.8.4",
@ -45,7 +45,7 @@
"shx": "^0.3.4",
"sinon": "^14.0.0",
"stream-browserify": "^3.0.0",
"ts-jest": "^29.1.1",
"ts-jest": "^29.2.5",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.0",

Просмотреть файл

@ -2,9 +2,13 @@
"name": "azure-kusto-data",
"version": "6.0.2",
"description": "Azure Data Explorer Query SDK",
"module": "dist-esm/src/index.js",
"types": "./types/src/index.d.ts",
"main": "dist-esm/src/index",
"type": "module",
"exports": {
".": {
"import": "./dist-esm/src/index.js",
"types": "./types/src/index.d.ts"
}
},
"scripts": {
"clean": "rimraf dist/* dist-esm/* types/*",
"build": "tsc -b"

Просмотреть файл

@ -6,15 +6,15 @@ import axios, { AxiosInstance, AxiosRequestConfig, RawAxiosRequestHeaders } from
import http from "http";
import https from "https";
import { v4 as uuidv4 } from "uuid";
import { KustoHeaders } from "./clientDetails";
import ClientRequestProperties from "./clientRequestProperties";
import CloudSettings from "./cloudSettings";
import ConnectionStringBuilder from "./connectionBuilder";
import { ThrottlingError } from "./errors";
import { kustoTrustedEndpoints } from "./kustoTrustedEndpoints";
import { KustoResponseDataSet, KustoResponseDataSetV1, KustoResponseDataSetV2, V1, V2Frames } from "./response";
import AadHelper from "./security";
import { toMilliseconds } from "./timeUtils";
import { KustoHeaders } from "./clientDetails.js";
import ClientRequestProperties from "./clientRequestProperties.js";
import CloudSettings from "./cloudSettings.js";
import ConnectionStringBuilder from "./connectionBuilder.js";
import { ThrottlingError } from "./errors.js";
import { kustoTrustedEndpoints } from "./kustoTrustedEndpoints.js";
import { KustoResponseDataSet, KustoResponseDataSetV1, KustoResponseDataSetV2, V1, V2Frames } from "./response.js";
import AadHelper from "./security.js";
import { toMilliseconds } from "./timeUtils.js";
const COMMAND_TIMEOUT_IN_MILLISECS = toMilliseconds(0, 10, 30);
const QUERY_TIMEOUT_IN_MILLISECS = toMilliseconds(0, 4, 30);

Просмотреть файл

@ -3,7 +3,7 @@
import { isNode } from "@azure/core-util";
import { userInfo } from "os";
import { SDK_VERSION } from "./version";
import { SDK_VERSION } from "./version.js";
// eslint-disable-next-line @typescript-eslint/no-namespace,@typescript-eslint/no-unused-vars -- This is the correct way to augment the global namespace
declare namespace NodeJS {

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { KustoHeaders } from "./clientDetails";
import { KustoHeaders } from "./clientDetails.js";
export class ClientRequestProperties {
private _options: { [option: string]: any };

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT License.
import { DeviceCodeInfo, InteractiveBrowserCredentialInBrowserOptions, InteractiveBrowserCredentialNodeOptions, TokenCredential } from "@azure/identity";
import KustoConnectionStringBuilderBase from "./connectionBuilderBase";
import KustoConnectionStringBuilderBase from "./connectionBuilderBase.js";
/* eslint-disable @typescript-eslint/no-unused-vars */

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT License.
import { DeviceCodeInfo, InteractiveBrowserCredentialInBrowserOptions, InteractiveBrowserCredentialNodeOptions, TokenCredential } from "@azure/identity";
import { KustoConnectionStringBuilderBase } from "./connectionBuilderBase";
import { KustoConnectionStringBuilderBase } from "./connectionBuilderBase.js";
/*
* A builder for Kusto connection strings

Просмотреть файл

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import { DeviceCodeInfo, InteractiveBrowserCredentialInBrowserOptions, InteractiveBrowserCredentialNodeOptions, TokenCredential } from "@azure/identity";
import { KeyOfType } from "./typeUtilts";
import { ClientDetails } from "./clientDetails";
import { KeyOfType } from "./typeUtilts.js";
import { ClientDetails } from "./clientDetails.js";
interface MappingType {
mappedTo: string;

Просмотреть файл

@ -1,15 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import KustoClient from "./client";
import ClientRequestProperties from "./clientRequestProperties";
import { CloudSettings, CloudInfo } from "./cloudSettings";
import KustoConnectionStringBuilder from "./connectionBuilder";
import * as KustoDataErrors from "./errors";
import { kustoTrustedEndpoints, MatchRule } from "./kustoTrustedEndpoints";
import { KustoResultColumn, KustoResultRow, KustoResultTable } from "./models";
import { KustoResponseDataSet } from "./response";
import { toMilliseconds } from "./timeUtils";
import KustoClient from "./client.js";
import ClientRequestProperties from "./clientRequestProperties.js";
import { CloudSettings, CloudInfo } from "./cloudSettings.js";
import KustoConnectionStringBuilder from "./connectionBuilder.js";
import * as KustoDataErrors from "./errors.js";
import { kustoTrustedEndpoints, MatchRule } from "./kustoTrustedEndpoints.js";
import { KustoResultColumn, KustoResultRow, KustoResultTable } from "./models.js";
import { KustoResponseDataSet } from "./response.js";
import { toMilliseconds } from "./timeUtils.js";
const TimeUtils = { toMilliseconds };

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { getStringTailLowerCase } from "./utils";
import { getStringTailLowerCase } from "./utils.js";
import { default as endpointsData } from "./wellKnownKustoEndpoints.json";
export class MatchRule {

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { parseKustoTimestampToMillis } from "./timeUtils";
import { parseKustoTimestampToMillis } from "./timeUtils.js";
export enum WellKnownDataSet {
PrimaryResult = "PrimaryResult",

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { KustoResultTable, Table, WellKnownDataSet } from "./models";
import { KustoResultTable, Table, WellKnownDataSet } from "./models.js";
interface V2DataSetHeaderFrame {
FrameType: "DataSetHeader";

Просмотреть файл

@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import KustoConnectionStringBuilder from "./connectionBuilder";
import * as TokenProvider from "./tokenProvider";
import { KustoAuthenticationError } from "./errors";
import { BasicTokenProvider, CallbackTokenProvider, TokenProviderBase, UserPromptProvider, TokenCredentialProvider } from "./tokenProvider";
import KustoConnectionStringBuilder from "./connectionBuilder.js";
import * as TokenProvider from "./tokenProvider.js";
import { KustoAuthenticationError } from "./errors.js";
import { BasicTokenProvider, CallbackTokenProvider, TokenProviderBase, UserPromptProvider, TokenCredentialProvider } from "./tokenProvider.js";
export class AadHelper {
tokenProvider?: TokenProviderBase;

Просмотреть файл

@ -15,7 +15,7 @@ import {
InteractiveBrowserCredential,
} from "@azure/identity";
import { TokenCredential } from "@azure/core-auth";
import { CloudInfo, CloudSettings } from "./cloudSettings";
import { CloudInfo, CloudSettings } from "./cloudSettings.js";
export declare type TokenResponse = {
tokenType: string;

Просмотреть файл

@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/* eslint-disable no-console */
import assert from "assert";
import { KustoConnectionStringBuilder as ConnectionStringBuilder } from "../src/connectionBuilder.browser.js";
const cluster = "https://somecluster.kusto.windows.net";
describe("Kcsb", () => {
it.concurrent("Fail to create non-browser compatible authentication", () => {
try {
ConnectionStringBuilder.withAadApplicationKeyAuthentication(cluster, "", "");
} catch (ex) {
assert(ex instanceof Error && ex.message.startsWith("Not supported in browser"));
return;
}
assert.fail();
});
it.concurrent("Create browser compatible authentication with params", () => {
ConnectionStringBuilder.withUserPrompt(cluster, { redirectUri: "redirect", clientId: "cid" });
});
it.concurrent("Create browser compatible authentication must provide clientId", () => {
try {
ConnectionStringBuilder.withUserPrompt(cluster, { redirectUri: "redirect" });
} catch (ex) {
assert((ex as Error).message.startsWith("Invalid parameters"));
return;
}
assert.fail();
});
it.concurrent("Create browser compatible authentication must provide redirectUri", () => {
try {
ConnectionStringBuilder.withUserPrompt(cluster, { clientId: "cid" });
} catch (ex) {
assert((ex as Error).message.startsWith("Invalid parameters"));
return;
}
assert.fail();
});
});

Просмотреть файл

@ -5,19 +5,19 @@ import assert from "assert";
import { v4 as uuidv4 } from "uuid";
import { KustoClient } from "../src/client";
import { KustoClient } from "../src/client.js";
import { ClientRequestProperties } from "../src/clientRequestProperties";
import { KustoResponseDataSetV1, KustoResponseDataSetV2 } from "../src/response";
import { ClientRequestProperties } from "../src/clientRequestProperties.js";
import { KustoResponseDataSetV1, KustoResponseDataSetV2 } from "../src/response.js";
import v2Response from "./data/response/v2.json";
import v2ResponseError from "./data/response/v2error.json";
import v1Response from "./data/response/v1.json";
import v1_2Response from "./data/response/v1_2.json";
import { Readable } from "stream";
import ConnectionBuilder from "../src/connectionBuilder";
import { CloudSettings } from "../src/cloudSettings";
import { toMilliseconds } from "../src/timeUtils";
import ConnectionBuilder from "../src/connectionBuilder.js";
import { CloudSettings } from "../src/cloudSettings.js";
import { toMilliseconds } from "../src/timeUtils.js";
enum ExecutionType {
Mgmt = "mgmt",

Просмотреть файл

@ -5,7 +5,7 @@
import assert from "assert";
import { v4 as uuidv4 } from "uuid";
import { KustoConnectionStringBuilder } from "../src/connectionBuilder";
import { KustoConnectionStringBuilder } from "../src/connectionBuilder.js";
import { DeviceCodeInfo } from "@azure/identity";
const doComparsion = (

Просмотреть файл

@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ClientDetails } from "../src/clientDetails";
import { ClientDetails } from "../src/clientDetails.js";
import assert from "assert";
describe("Test Headers", () => {

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { kustoTrustedEndpoints, MatchRule } from "../src/kustoTrustedEndpoints";
import { kustoTrustedEndpoints, MatchRule } from "azure-kusto-data";
const DEFAULT_PUBLIC_LOGIN_URL = "https://login.microsoftonline.com";
const CHINA_CLOUD_LOGIN = "https://login.partner.microsoftonline.cn";

Просмотреть файл

@ -2,9 +2,9 @@
// Licensed under the MIT License.
import assert from "assert";
import { KustoResultColumn, KustoResultRow, KustoResultTable } from "../src/models";
import v2 from "./data/response/v2";
import { parseKustoTimestampToMillis } from "../src/timeUtils";
import { KustoResultColumn, KustoResultRow, KustoResultTable } from "../src/models.js";
import v2 from "./data/response/v2.js";
import { parseKustoTimestampToMillis } from "../src/timeUtils.js";
const v2Response = v2;

Просмотреть файл

@ -4,7 +4,7 @@
import assert from "assert";
import v2Response from "./data/response/v2.json";
import { KustoResponseDataSetV2, V2Frames } from "../src/response";
import { KustoResponseDataSetV2, V2Frames } from "../src/response.js";
describe("KustoResultDataSet", () => {
describe("#constructor()", () => {

Просмотреть файл

@ -1,13 +1,13 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { KustoConnectionStringBuilder } from "../src/index";
import AadHelper from "../src/security";
import { CloudSettings } from "../src/cloudSettings";
import { KustoConnectionStringBuilder } from "../src/index.js";
import AadHelper from "../src/security.js";
import { CloudSettings } from "../src/cloudSettings.js";
import assert from "assert";
import { KustoAuthenticationError } from "../src/errors";
import { KustoAuthenticationError } from "../src/errors.js";
import { CredentialUnavailableError } from "@azure/identity";
import { loginTest, manualLoginTest } from "./data/testUtils";
import { loginTest, manualLoginTest } from "./data/testUtils.js";
beforeAll(() => {
CloudSettings.writeToCache("https://somecluster.kusto.windows.net");

Просмотреть файл

@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CloudSettings } from "../src/cloudSettings";
import { CloudSettings } from "../src/cloudSettings.js";
import assert from "assert";
import { UserPassTokenProvider } from "../src/tokenProvider";
import { UserPassTokenProvider } from "../src/tokenProvider.js";
describe("CloudInfo", () => {
describe("#CloudInfo", () => {

Просмотреть файл

@ -2,9 +2,13 @@
"name": "azure-kusto-ingest",
"version": "6.0.2",
"description": "Azure Data Explorer Ingestion SDK",
"module": "dist-esm/src/index.js",
"types": "./types/src/index.d.ts",
"main": "dist-esm/src/index",
"type": "module",
"exports": {
".": {
"import": "./dist-esm/src/index.js",
"types": "./types/src/index.d.ts"
}
},
"scripts": {
"build": "tsc -b",
"clean": "rimraf dist/* dist-esm/* types/*"

Просмотреть файл

@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { IngestionProperties, IngestionPropertiesInput } from "./ingestionProperties";
import { StreamDescriptor, FileDescriptorBase, BlobDescriptor } from "./descriptors";
import { IngestionProperties, IngestionPropertiesInput } from "./ingestionProperties.js";
import { StreamDescriptor, FileDescriptorBase, BlobDescriptor } from "./descriptors.js";
import isIP from "is-ip";
const INGEST_PREFIX = "ingest-";

Просмотреть файл

@ -3,7 +3,7 @@
/* eslint-disable @typescript-eslint/ban-types -- We legitimately want to use {} as a "any non-nullable type" */
import { IngestionMappingKind } from "./ingestionProperties";
import { IngestionMappingKind } from "./ingestionProperties.js";
export enum FieldTransformation {
PropertyBagArrayToDictionary = "PropertyBagArrayToDictionary",

Просмотреть файл

@ -4,7 +4,7 @@
import { v4 as uuidv4 } from "uuid";
import uuidValidate from "uuid-validate";
import { Readable } from "stream";
import IngestionProperties from "./ingestionProperties";
import IngestionProperties from "./ingestionProperties.js";
import { BlobClient } from "@azure/storage-blob";
export enum CompressionType {

Просмотреть файл

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import pako from "pako";
import { AbstractDescriptor, CompressionType, FileDescriptorBase, shouldCompressFileByExtension } from "./descriptors";
import { IngestionPropertiesInput, shouldCompressFileByFormat } from "./ingestionProperties";
import { AbstractDescriptor, CompressionType, FileDescriptorBase, shouldCompressFileByExtension } from "./descriptors.js";
import { IngestionPropertiesInput, shouldCompressFileByFormat } from "./ingestionProperties.js";
export class FileDescriptor extends AbstractDescriptor implements FileDescriptorBase {
size: number | null;

Просмотреть файл

@ -6,8 +6,8 @@ import pathlib from "path";
import fs from "fs";
import { file as tmpFile } from "tmp-promise";
import { promisify } from "util";
import { AbstractDescriptor, CompressionType, FileDescriptorBase, shouldCompressFileByExtension } from "./descriptors";
import { IngestionPropertiesInput, shouldCompressFileByFormat } from "./ingestionProperties";
import { AbstractDescriptor, CompressionType, FileDescriptorBase, shouldCompressFileByExtension } from "./descriptors.js";
import { IngestionPropertiesInput, shouldCompressFileByFormat } from "./ingestionProperties.js";
/**
* Describes a file to be ingested. Use string to describe a local path in Node.JS and Blob object in browsers

Просмотреть файл

@ -1,15 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import KustoIngestClient from "./ingestClient";
import KustoIngestClient from "./ingestClient.js";
import streamingIngestClient from "./streamingIngestClient";
import streamingIngestClient from "./streamingIngestClient.js";
import managedStreamingIngestClient from "./managedStreamingIngestClient";
import managedStreamingIngestClient from "./managedStreamingIngestClient.js";
import KustoIngestStatusQueues from "./status";
import KustoIngestStatusQueues from "./status.js";
import { IngestionResult, OperationStatus, IngestionStatus, IngestionStatusInTableDescription } from "./ingestionResult";
import { IngestionResult, OperationStatus, IngestionStatus, IngestionStatusInTableDescription } from "./ingestionResult.js";
import {
DataFormat,
IngestionMappingKind,
@ -19,7 +19,7 @@ import {
ValidationOptions,
ValidationPolicy,
dataFormatMappingKind,
} from "./ingestionProperties";
} from "./ingestionProperties.js";
import {
ApacheAvroColumnMapping,
@ -33,12 +33,12 @@ import {
ParquetColumnMapping,
SStreamColumnMapping,
W3CLogFileMapping,
} from "./columnMappings";
import { BlobDescriptor, CompressionType, StreamDescriptor } from "./descriptors";
import { FileDescriptor } from "./fileDescriptor";
} from "./columnMappings.js";
import { BlobDescriptor, CompressionType, StreamDescriptor } from "./descriptors.js";
import { FileDescriptor } from "./fileDescriptor.js";
export { Transformation as ColumnMappingTransformation } from "./columnMappings";
export { IngestionProperties } from "./ingestionProperties";
export { Transformation as ColumnMappingTransformation } from "./columnMappings.js";
export { IngestionProperties } from "./ingestionProperties.js";
export {
KustoIngestClient as IngestClient,
KustoIngestStatusQueues as IngestStatusQueues,
@ -114,5 +114,5 @@ export const IngestionPropertiesEnums = {
ColumnMapping,
};
export { IngestionPropertiesValidationError } from "./errors";
export { IngestionPropertiesValidationError } from "./errors.js";
// eslint-disable-next-line no-console

Просмотреть файл

@ -3,12 +3,12 @@
import { KustoConnectionStringBuilder } from "azure-kusto-data";
import { BlobDescriptor, generateBlobName, StreamDescriptor } from "./descriptors";
import { FileDescriptor } from "./fileDescriptor.browser";
import { BlobDescriptor, generateBlobName, StreamDescriptor } from "./descriptors.js";
import { FileDescriptor } from "./fileDescriptor.browser.js";
import { IngestionPropertiesInput } from "./ingestionProperties";
import { KustoIngestClientBase } from "./ingestClientBase";
import { IngestionResult } from "./ingestionResult";
import { IngestionPropertiesInput } from "./ingestionProperties.js";
import { KustoIngestClientBase } from "./ingestClientBase.js";
import { IngestionResult } from "./ingestionResult.js";
export class KustoIngestClient extends KustoIngestClientBase {
constructor(kcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput, autoCorrectEndpoint?: boolean) {

Просмотреть файл

@ -3,13 +3,13 @@
import { KustoConnectionStringBuilder } from "azure-kusto-data";
import { BlobDescriptor, generateBlobName, StreamDescriptor } from "./descriptors";
import { FileDescriptor } from "./fileDescriptor";
import { BlobDescriptor, generateBlobName, StreamDescriptor } from "./descriptors.js";
import { FileDescriptor } from "./fileDescriptor.js";
import { IngestionPropertiesInput } from "./ingestionProperties";
import { KustoIngestClientBase } from "./ingestClientBase";
import { IngestionPropertiesInput } from "./ingestionProperties.js";
import { KustoIngestClientBase } from "./ingestClientBase.js";
import { Readable } from "stream";
import { IngestionResult } from "./ingestionResult";
import { IngestionResult } from "./ingestionResult.js";
export class KustoIngestClient extends KustoIngestClientBase {
constructor(kcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput, autoCorrectEndpoint?: boolean) {

Просмотреть файл

@ -3,15 +3,15 @@
import { Client as KustoClient, KustoConnectionStringBuilder } from "azure-kusto-data";
import ResourceManager from "./resourceManager";
import ResourceManager from "./resourceManager.js";
import IngestionBlobInfo from "./ingestionBlobInfo";
import IngestionBlobInfo from "./ingestionBlobInfo.js";
import { ContainerClient } from "@azure/storage-blob";
import { QueueClient } from "@azure/storage-queue";
import IngestionProperties, { IngestionPropertiesInput, ReportLevel, ReportMethod } from "./ingestionProperties";
import { AbstractKustoClient } from "./abstractKustoClient";
import IngestionProperties, { IngestionPropertiesInput, ReportLevel, ReportMethod } from "./ingestionProperties.js";
import { AbstractKustoClient } from "./abstractKustoClient.js";
import {
IngestionStatus,
TableReportIngestionResult,
@ -20,10 +20,10 @@ import {
IngestionStatusResult,
OperationStatus,
putRecordInTable,
} from "./ingestionResult";
} from "./ingestionResult.js";
import { Readable } from "stream";
import { BlobDescriptor, StreamDescriptor } from "./descriptors";
import { BlobDescriptor, StreamDescriptor } from "./descriptors.js";
export abstract class KustoIngestClientBase extends AbstractKustoClient {
resourceManager: ResourceManager;

Просмотреть файл

@ -2,9 +2,9 @@
// Licensed under the MIT License.
import { v4 as uuidv4 } from "uuid";
import { BlobDescriptor } from "./descriptors";
import IngestionProperties, { ReportLevel, ReportMethod } from "./ingestionProperties";
import { IngestionStatusInTableDescription } from "./ingestionResult";
import { BlobDescriptor } from "./descriptors.js";
import IngestionProperties, { ReportLevel, ReportMethod } from "./ingestionProperties.js";
import { IngestionStatusInTableDescription } from "./ingestionResult.js";
export class IngestionBlobInfo {
BlobPath: string;

Просмотреть файл

@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { IngestionPropertiesValidationError } from "./errors";
import { ColumnMapping } from "./columnMappings";
import { IngestionPropertiesValidationError } from "./errors.js";
import { ColumnMapping } from "./columnMappings.js";
/**
* Data formats supported for Kusto ingestion.

Просмотреть файл

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import { TableClient, TableEntity } from "@azure/data-tables";
import { ExponentialRetry } from "./retry";
import { createStatusTableClient } from "./resourceManager";
import { ExponentialRetry } from "./retry.js";
import { createStatusTableClient } from "./resourceManager.js";
export interface IngestionResult {
/// <summary>
/// Retrieves the detailed ingestion status of

Просмотреть файл

@ -1,19 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { IngestionPropertiesInput } from "./ingestionProperties";
import { IngestionPropertiesInput } from "./ingestionProperties.js";
import { isNode } from "@azure/core-util";
import { KustoConnectionStringBuilder, KustoResponseDataSet } from "azure-kusto-data";
import { Readable } from "stream";
import { AbstractKustoClient } from "./abstractKustoClient";
import { AbstractDescriptor, BlobDescriptor, StreamDescriptor } from "./descriptors";
import { FileDescriptor } from "./fileDescriptor";
import IngestClient from "./ingestClient";
import { ExponentialRetry } from "./retry";
import { readableToStream, tryFileToBuffer, tryStreamToArray } from "./streamUtils";
import StreamingIngestClient from "./streamingIngestClient";
import { IngestionResult } from "./ingestionResult";
import { AbstractKustoClient } from "./abstractKustoClient.js";
import { AbstractDescriptor, BlobDescriptor, StreamDescriptor } from "./descriptors.js";
import { FileDescriptor } from "./fileDescriptor.js";
import IngestClient from "./ingestClient.js";
import { ExponentialRetry } from "./retry.js";
import { readableToStream, tryFileToBuffer, tryStreamToArray } from "./streamUtils.js";
import StreamingIngestClient from "./streamingIngestClient.js";
import { IngestionResult } from "./ingestionResult.js";
const maxStreamSize = 1024 * 1024 * 4;
const attemptCount = 3;

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { RankedStorageAccount } from "./rankedStorageAccount";
import { RankedStorageAccount } from "./rankedStorageAccount.js";
export class RankedStorageAccountSet {
public static readonly DefaultNumberOfBuckets: number = 6;

Просмотреть файл

@ -2,10 +2,10 @@
// Licensed under the MIT License.
import { Client, KustoDataErrors, TimeUtils } from "azure-kusto-data";
import { ExponentialRetry } from "./retry";
import { ExponentialRetry } from "./retry.js";
import { ContainerClient } from "@azure/storage-blob";
import { TableClient } from "@azure/data-tables";
import { RankedStorageAccountSet } from "./rankedStorageAccountSet";
import { RankedStorageAccountSet } from "./rankedStorageAccountSet.js";
import { QueueClient } from "@azure/storage-queue";
const ATTEMPT_COUNT = 4;

Просмотреть файл

@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StatusQueue } from "./statusQ";
import KustoIngestClient from "./ingestClient";
import { ResourceURI } from "./resourceManager";
import { StatusQueue } from "./statusQ.js";
import KustoIngestClient from "./ingestClient.js";
import { ResourceURI } from "./resourceManager.js";
export class StatusMessage {
OperationId?: string;

Просмотреть файл

@ -2,8 +2,8 @@
// Licensed under the MIT License.
import { PeekedMessageItem, QueueClient } from "@azure/storage-queue";
import { ResourceURI } from "./resourceManager";
import { StatusMessage } from "./status";
import { ResourceURI } from "./resourceManager.js";
import { StatusMessage } from "./status.js";
class QueueDetails {
constructor(readonly name: string, readonly service: QueueClient) {}

Просмотреть файл

@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CompressionType, StreamDescriptor } from "./descriptors";
import { FileDescriptor } from "./fileDescriptor.browser";
import { CompressionType, StreamDescriptor } from "./descriptors.js";
import { FileDescriptor } from "./fileDescriptor.browser.js";
export const fileToStream = async (file: FileDescriptor): Promise<StreamDescriptor> => {
const streamFs = await (file.file as Blob).arrayBuffer();

Просмотреть файл

@ -4,8 +4,8 @@
import fs from "fs";
import { PassThrough, Readable } from "stream";
import streamify from "stream-array";
import { CompressionType, StreamDescriptor } from "./descriptors";
import { FileDescriptor } from "./fileDescriptor";
import { CompressionType, StreamDescriptor } from "./descriptors.js";
import { FileDescriptor } from "./fileDescriptor.js";
// Returns fs.ReadStream for node and NodeJS.ReadableStream in browser
export const fileToStream = (fileDescriptor: FileDescriptor): Promise<StreamDescriptor> => {

Просмотреть файл

@ -1,13 +1,13 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { IngestionPropertiesInput } from "./ingestionProperties";
import { IngestionPropertiesInput } from "./ingestionProperties.js";
import { KustoConnectionStringBuilder, KustoResponseDataSet } from "azure-kusto-data";
import { StreamDescriptor } from "./descriptors";
import { FileDescriptor } from "./fileDescriptor.browser";
import { tryFileToBuffer } from "./streamUtils.browser";
import { KustoStreamingIngestClientBase } from "./streamingIngestClientBase";
import { StreamDescriptor } from "./descriptors.js";
import { FileDescriptor } from "./fileDescriptor.browser.js";
import { tryFileToBuffer } from "./streamUtils.browser.js";
import { KustoStreamingIngestClientBase } from "./streamingIngestClientBase.js";
class KustoStreamingIngestClient extends KustoStreamingIngestClientBase {
constructor(kcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput, autoCorrectEndpoint?: boolean) {

Просмотреть файл

@ -1,15 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { IngestionPropertiesInput } from "./ingestionProperties";
import { IngestionPropertiesInput } from "./ingestionProperties.js";
import { KustoConnectionStringBuilder, KustoResponseDataSet } from "azure-kusto-data";
import { Readable } from "stream";
import zlib from "zlib";
import { CompressionType, StreamDescriptor } from "./descriptors";
import { FileDescriptor } from "./fileDescriptor";
import { fileToStream } from "./streamUtils";
import { KustoStreamingIngestClientBase } from "./streamingIngestClientBase";
import { CompressionType, StreamDescriptor } from "./descriptors.js";
import { FileDescriptor } from "./fileDescriptor.js";
import { fileToStream } from "./streamUtils.js";
import { KustoStreamingIngestClientBase } from "./streamingIngestClientBase.js";
class KustoStreamingIngestClient extends KustoStreamingIngestClientBase {
constructor(kcsb: string | KustoConnectionStringBuilder, defaultProps?: IngestionPropertiesInput, autoCorrectEndpoint?: boolean) {

Просмотреть файл

@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { IngestionPropertiesInput } from "./ingestionProperties";
import { IngestionPropertiesInput } from "./ingestionProperties.js";
import { BlobDescriptor } from "./descriptors";
import { AbstractKustoClient } from "./abstractKustoClient";
import { BlobDescriptor } from "./descriptors.js";
import { AbstractKustoClient } from "./abstractKustoClient.js";
import { Client as KustoClient, KustoConnectionStringBuilder } from "azure-kusto-data";
export abstract class KustoStreamingIngestClientBase extends AbstractKustoClient {

Просмотреть файл

@ -4,80 +4,42 @@
/* eslint-disable no-console */
import assert from "assert";
import IngestClient from "../src/ingestClient.browser";
import { KustoConnectionStringBuilder as ConnectionStringBuilder } from "azure-kusto-data/src/connectionBuilder.browser";
import IngestClient from "../src/ingestClient.browser.js";
import sinon from "sinon";
import { IngestionResult } from "../src/ingestionResult";
import { IngestionResult } from "azure-kusto-ingest";
describe(`Browser Unit tests`, () => {
const cluster = "https://somecluster.kusto.windows.net";
describe("Kcsb", () => {
it.concurrent("Ingest from browser calls the right components", async () => {
const sandbox = sinon.createSandbox();
describe("Kcsb", () => {
it.concurrent("Fail to create non-browser compatible authentication", () => {
try {
ConnectionStringBuilder.withAadApplicationKeyAuthentication(cluster, "", "");
} catch (ex) {
assert(ex instanceof Error && ex.message.startsWith("Not supported in browser"));
return;
}
assert.fail();
const mockedIngestClient = new IngestClient("http://test.kusto.com", {
table: "t1",
database: "d1",
});
it.concurrent("Create browser compatible authentication with params", () => {
ConnectionStringBuilder.withUserPrompt(cluster, { redirectUri: "redirect", clientId: "cid" });
});
it.concurrent("Create browser compatible authentication must provide clientId", () => {
try {
ConnectionStringBuilder.withUserPrompt(cluster, { redirectUri: "redirect" });
} catch (ex) {
assert((ex as Error).message.startsWith("Invalid parameters"));
return;
}
assert.fail();
});
it.concurrent("Create browser compatible authentication must provide redirectUri", () => {
try {
ConnectionStringBuilder.withUserPrompt(cluster, { clientId: "cid" });
} catch (ex) {
assert((ex as Error).message.startsWith("Invalid parameters"));
return;
}
const queuedStub = sinon.stub(mockedIngestClient, "ingestFromBlob");
queuedStub.resolves({} as IngestionResult);
const blobUploadStub = sinon.stub(mockedIngestClient, "uploadToBlobWithRetry");
blobUploadStub.resolves("https://storage.blob.windows.net/container/file.json.gz");
assert.fail();
});
it.concurrent("Ingest from browser calls the right components", async () => {
const sandbox = sinon.createSandbox();
const mockedIngestClient = new IngestClient("http://test.kusto.com", {
table: "t1",
database: "d1",
});
const queuedStub = sinon.stub(mockedIngestClient, "ingestFromBlob");
queuedStub.resolves({} as IngestionResult);
const blobUploadStub = sinon.stub(mockedIngestClient, "uploadToBlobWithRetry");
blobUploadStub.resolves("https://storage.blob.windows.net/container/file.json.gz");
await mockedIngestClient.ingestFromFile({} as Blob);
sandbox.assert.calledOnce(queuedStub);
sandbox.assert.calledOnce(blobUploadStub);
});
it.concurrent("auto correct from query endpoint", () => {
const client = new IngestClient("https://somecluster.kusto.windows.net");
assert.strictEqual(
client.resourceManager.kustoClient.cluster,
"https://ingest-somecluster.kusto.windows.net",
"Kusto cluster URL does not match expected value"
);
});
it.concurrent("auto correct from ingestion endpoint", () => {
const client = new IngestClient("https://ingest-somecluster.kusto.windows.net");
assert.strictEqual(
client.resourceManager.kustoClient.cluster,
"https://ingest-somecluster.kusto.windows.net",
"Kusto cluster URL does not match expected value"
);
});
await mockedIngestClient.ingestFromFile({} as Blob);
sandbox.assert.calledOnce(queuedStub);
sandbox.assert.calledOnce(blobUploadStub);
});
it.concurrent("auto correct from query endpoint", () => {
const client = new IngestClient("https://somecluster.kusto.windows.net");
assert.strictEqual(
client.resourceManager.kustoClient.cluster,
"https://ingest-somecluster.kusto.windows.net",
"Kusto cluster URL does not match expected value"
);
});
it.concurrent("auto correct from ingestion endpoint", () => {
const client = new IngestClient("https://ingest-somecluster.kusto.windows.net");
assert.strictEqual(
client.resourceManager.kustoClient.cluster,
"https://ingest-somecluster.kusto.windows.net",
"Kusto cluster URL does not match expected value"
);
});
});

Просмотреть файл

@ -3,8 +3,8 @@
import assert from "assert";
import { Readable } from "stream";
import { DataFormat, IngestionDescriptors, IngestionProperties } from "../src";
import { generateBlobName } from "../src/descriptors";
import { DataFormat, IngestionDescriptors, IngestionProperties } from "azure-kusto-ingest";
import { generateBlobName } from "../src/descriptors.js";
describe("FileDescriptor", () => {
describe("#constructor()", () => {

Просмотреть файл

@ -24,17 +24,23 @@ import {
StreamingIngestClient,
IngestionStatus,
IngestionResult,
} from "../../src";
import { sleep } from "../../src/retry";
} from "azure-kusto-ingest";
import { type AxiosError } from "axios";
import { sleep } from "../../src/retry.js";
import { AzureCliCredential } from "@azure/identity";
import assert from "assert";
import fs, { ReadStream } from "fs";
import util from "util";
import { v4 as uuidv4 } from "uuid";
import pathlib from "path";
import { basename, dirname } from "path";
import sinon from "sinon";
import { TableReportIngestionResult } from "../../src/ingestionResult";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
interface ParsedJsonMapping {
Properties: { Path: string };
@ -254,7 +260,7 @@ const main = (): void => {
try {
const res: IngestionResult = await ingestClient.ingestFromFile(item.path, props);
assert.ok(res, "ingest result returned null or undefined");
assert.ok(res instanceof TableReportIngestionResult);
assert.equal(res.constructor.name, "TableReportIngestionResult");
let status: IngestionStatus;
const endTime = Date.now() + 180000; // Timeout is 3 minutes
while (Date.now() < endTime) {
@ -334,7 +340,7 @@ const main = (): void => {
return { item: i };
})
)("ingestFromBlob_$item.description", async ({ item }) => {
const blobName = uuidv4() + pathlib.basename(item.path);
const blobName = uuidv4() + basename(item.path);
const blobUri = await ingestClient.uploadToBlobWithRetry(item.path, blobName);
const table = tableNames[("streaming_blob" + "_" + item.description) as Table];

Просмотреть файл

@ -2,11 +2,11 @@
// Licensed under the MIT License.
import assert from "assert";
import { KustoIngestClient } from "../src/ingestClient";
import { DataFormat, IngestionProperties, IngestionPropertiesInput, ReportLevel, ReportMethod } from "../src/ingestionProperties";
import { IngestionPropertiesValidationError } from "../src/errors";
import KustoStreamingIngestClient from "../src/streamingIngestClient";
import KustoManagedStreamingIngestClient from "../src/managedStreamingIngestClient";
import { KustoIngestClient } from "../src/ingestClient.js";
import { DataFormat, IngestionProperties, IngestionPropertiesInput, ReportLevel, ReportMethod } from "../src/ingestionProperties.js";
import { IngestionPropertiesValidationError } from "../src/errors.js";
import KustoStreamingIngestClient from "../src/streamingIngestClient.js";
import KustoManagedStreamingIngestClient from "../src/managedStreamingIngestClient.js";
import { KustoConnectionStringBuilder } from "azure-kusto-data";
import { Readable } from "stream";

Просмотреть файл

@ -18,8 +18,8 @@ import {
W3CLogFileMapping,
} from "azure-kusto-ingest";
import { IngestionBlobInfo } from "../src/ingestionBlobInfo";
import { BlobDescriptor } from "../src/descriptors";
import { IngestionBlobInfo } from "../src/ingestionBlobInfo.js";
import { BlobDescriptor } from "../src/descriptors.js";
describe("IngestionProperties", () => {
describe("#constructor()", () => {

Просмотреть файл

@ -4,16 +4,15 @@
/* eslint-disable no-console */
import sinon from "sinon";
import { StreamingIngestClient } from "../src";
import { StreamDescriptor } from "../src/descriptors";
import { KustoIngestClient } from "../src/ingestClient";
import { DataFormat, IngestionProperties, IngestionPropertiesInput } from "../src/ingestionProperties";
import KustoManagedStreamingIngestClient from "../src/managedStreamingIngestClient";
import { StreamingIngestClient, IngestionResult } from "azure-kusto-ingest";
import { StreamDescriptor } from "../src/descriptors.js";
import { KustoIngestClient } from "../src/ingestClient.js";
import { DataFormat, IngestionProperties, IngestionPropertiesInput } from "../src/ingestionProperties.js";
import KustoManagedStreamingIngestClient from "../src/managedStreamingIngestClient.js";
import { Readable } from "stream";
import { CloudSettings, KustoConnectionStringBuilder } from "azure-kusto-data";
import assert from "assert";
import uuidValidate from "uuid-validate";
import { IngestionResult } from "../src/ingestionResult";
type IngestFromStreamStub = sinon.SinonStub<[StreamDescriptor | Readable | ArrayBuffer, IngestionPropertiesInput?, string?], Promise<IngestionResult>>;
beforeAll(() => {

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT License.
import assert from "assert";
import { RankedStorageAccountSet } from "../src/rankedStorageAccountSet";
import { RankedStorageAccountSet } from "../src/rankedStorageAccountSet.js";
describe("RankedStorageAccountSet", () => {
describe("Input validation.", () => {

Просмотреть файл

@ -6,7 +6,7 @@ import assert from "assert";
import sinon from "sinon";
import { Client as KustoClient, KustoResponseDataSet, TimeUtils } from "azure-kusto-data";
import { IngestClientResources, ResourceManager, ResourceType } from "../src/resourceManager";
import { IngestClientResources, ResourceManager, ResourceType } from "../src/resourceManager.js";
describe("ResourceManager", () => {
const rows = [

Просмотреть файл

@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2017",
"module": "CommonJS",
"module": "NodeNext",
"esModuleInterop": true,
"strict": true,
"incremental": true,
@ -11,7 +11,6 @@
"declaration": true,
"declarationMap": true,
"noUnusedParameters": true,
"moduleResolution": "node",
"inlineSources": true
},
"include": [

Просмотреть файл

@ -16,7 +16,11 @@ let config = {
},
resolve: {
aliasFields: ["browser"],
fallback: { stream: require.resolve("stream-browserify") }, // Over fallbacks are in the package.json file
fallback: {
stream: require.resolve("stream-browserify"),
// ESM has issue importing process/browser without this resolve
"process/browser": require.resolve("process/browser"),
}, // Over fallbacks are in the package.json file
extensions: [".ts", ".js"],
},
devtool: "inline-source-map",
@ -27,9 +31,6 @@ let config = {
port: 3000, // This port should be open in the SPA aad app
},
plugins: [
new webpack.ProvidePlugin({
process: "process/browser",
}),
// Work around for Buffer is undefined:
// https://github.com/webpack/changelog-v5/issues/10
new webpack.ProvidePlugin({