@azure/synapse

中文文档
1.0.0-preview.1发布于 2020/02/27MITTypeScriptESM + CJS近 30 天下载 2686

SynapseClient Library with typescript type definitions for node.js and browser.

此软件包已被标记为弃用

New packages available.

原始使用文档
文档目录5 节
  1. Azure SynapseClient SDK for JavaScript
  2. Currently supported environments
  3. How to Install
  4. How to use
  5. Related projects

Azure SynapseClient SDK for JavaScript

This package contains an isomorphic SDK for SynapseClient.

Currently supported environments

  • Node.js version 6.x.x or higher
  • Browser JavaScript

How to Install

npm install @azure/synapse

How to use

nodejs - Authentication, client creation and getHistoryServerData monitoring as an example written in TypeScript.

Install @azure/ms-rest-nodeauth
  • Please install minimum version of "@azure/ms-rest-nodeauth": "^3.0.0".
npm install @azure/ms-rest-nodeauth@"^3.0.0"
Sample code
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { SynapseClient, SynapseModels, SynapseMappers } from "@azure/synapse";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
  const client = new SynapseClient(creds, subscriptionId);
  const workspaceName = "testworkspaceName";
  const poolName = "testpoolName";
  const livyId = "testlivyId";
  const appId = "testappId";
  const attemptId = "testattemptId";
  client.monitoring.getHistoryServerData(workspaceName, poolName, livyId, appId, attemptId).then((result) => {
    console.log("The result is:");
    console.log(result);
  });
}).catch((err) => {
  console.error(err);
});

browser - Authentication, client creation and getHistoryServerData monitoring as an example written in JavaScript.

Install @azure/ms-rest-browserauth
npm install @azure/ms-rest-browserauth
Sample code

See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.

  • index.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>@azure/synapse sample</title>
    <script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
    <script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
    <script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
    <script src="node_modules/@azure/synapse/dist/synapse.js"></script>
    <script type="text/javascript">
      const subscriptionId = "<Subscription_Id>";
      const authManager = new msAuth.AuthManager({
        clientId: "<client id for your Azure AD app>",
        tenant: "<optional tenant for your organization>"
      });
      authManager.finalizeLogin().then((res) => {
        if (!res.isLoggedIn) {
          // may cause redirects
          authManager.login();
        }
        const client = new Azure.Synapse.SynapseClient(res.creds, subscriptionId);
        const workspaceName = "testworkspaceName";
        const poolName = "testpoolName";
        const livyId = "testlivyId";
        const appId = "testappId";
        const attemptId = "testattemptId";
        client.monitoring.getHistoryServerData(workspaceName, poolName, livyId, appId, attemptId).then((result) => {
          console.log("The result is:");
          console.log(result);
        }).catch((err) => {
          console.log("An error occurred:");
          console.error(err);
        });
      });
    </script>
  </head>
  <body></body>
</html>

Impressions

版本与发布记录

@azure/synapse 共发布 1 个版本,首次发布于 2020/02/27;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0-preview.1latest2020/02/276 年前

关于 @azure/synapse 的常见问题

@azure/synapse 是什么?

SynapseClient Library with typescript type definitions for node.js and browser.注意:该包已被作者标记为弃用——New packages available.

如何安装 @azure/synapse?

在项目目录运行 npm install @azure/synapse,或使用 pnpm add / yarn add / bun add。

@azure/synapse 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@azure/synapse 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@azure/synapse 可以商用吗?

@azure/synapse 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@azure/synapse 的下载量有多少?

根据 npm 官方下载统计,@azure/synapse 在 2026/10/08 – 2026/11/06 这 30 天内被下载 2,686 次,日均约 90 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@azure/synapse 还在维护吗?

最新版本 1.0.0-preview.1 发布于 2020/02/27(6 年前);至今共发布 1 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/02/27。作者已将其标记为弃用,新项目建议寻找替代方案。