Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@azure-tools/rlc-common
Advanced tools
import { RLCModel } from "../interfaces.js"; // @ts-ignore: to fix the handlebars issue import hbs from "handlebars"; import { NameType, normalizeName } from "../helpers/nameUtils.js";
const readmeTemplate = `# {{ clientDescriptiveName }} library for JavaScript
{{ description }}
{{#if azureArm}} **If you are not familiar with our REST client, please spend 5 minutes to take a look at {{#if serviceDocURL}}[the service's documentation]({{ serviceDocURL }}) and {{/if}}our REST client docs to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api {{else}} Please rely heavily on {{#if serviceDocURL}}[the service's documentation]({{ serviceDocURL }}) and {{/if}}our REST client docs to use this library {{/if}}
Key links:
{{#if packageSourceURL}}
Install the {{ clientDescriptiveName }} REST client library for JavaScript with `npm`:
```bash npm install {{ clientPackageName }} ```
To use an Azure Active Directory (AAD) token credential, provide an instance of the desired credential type obtained from the @azure/identity library.
To authenticate with AAD, you must first `npm` install `@azure/identity` {{#if dependencyLink}}and [{{dependencyDescription }}]({{ dependencyLink }}){{/if}}
After setup, you can choose which type of credential from `@azure/identity` to use. As an example, DefaultAzureCredential can be used to authenticate the client.
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
```javascript import { setLogLevel } from "@azure/logger";
setLogLevel("info"); ```
For more detailed instructions on how to enable logs, you can look at the @azure/logger package docs. `;
/**
export function buildReadmeFile(model: RLCModel) { const generateMetadata = Boolean(model.options?.generateMetadata); if (!generateMetadata) { return; }
const metadata = createMetadata(model) ?? {}; const readmeFileContents = hbs.compile(readmeTemplate, { noEscape: true }); return { path: "README.md", content: readmeFileContents(metadata) }; }
/**
const azureHuh =
packageDetails?.scopeName === "azure" ||
packageDetails?.scopeName === "azure-rest";
const repoURL = "https://github.com/Azure/azure-sdk-for-js";
const relativePackageSourcePath = azureOutputDirectory;
const packageSourceURL =
relativePackageSourcePath &&
repoURL &&
${repoURL}/tree/main/${relativePackageSourcePath}
;
const clientPackageName = packageDetails?.name; const clientClassName = getClientName(model); const serviceName = getServiceName(model); var apiRefUrlQueryParameter: string = ""; if (packageDetails?.version.includes("beta")) { apiRefUrlQueryParameter = "?view=azure-node-preview"; }
return {
serviceName,
clientClassName,
clientPackageName: clientPackageName,
clientDescriptiveName: ${serviceName} REST client
,
description: serviceInfo?.description ?? packageDetails.description,
serviceDocURL: productDocLink,
packageSourceURL: packageSourceURL,
packageNPMURL: https://www.npmjs.com/package/${clientPackageName}
,
samplesURL: packageSourceURL && ${packageSourceURL}/samples
,
apiRefURL: azureHuh
? https://docs.microsoft.com/javascript/api/${clientPackageName}${apiRefUrlQueryParameter}
: undefined,
dependencyDescription: dependencyInfo?.description,
dependencyLink: dependencyInfo?.link,
hasMultiClients: multiClient && batch && batch.length > 1,
azureArm: Boolean(model.options.azureArm)
};
}
function getServiceName(model: RLCModel) { const azureHuh = model?.options?.packageDetails?.scopeName === "azure" || model?.options?.packageDetails?.scopeName === "azure-rest"; const libraryName = model.libraryName; const serviceTitle = model.options?.serviceInfo?.title ?? model.libraryName; const batch = model?.options?.batch, packageDetails = model?.options?.packageDetails!; let simpleServiceName = batch && batch.length > 1 ? normalizeName(packageDetails.nameWithoutScope || "", NameType.Class) : normalizeName(serviceTitle, NameType.Class); simpleServiceName = /** * It is a required convention in Azure swaggers for their titles to end with * "Client". / serviceTitle.match(/(.) Client/)?.[1] ?? serviceTitle.match(/(.)Client/)?.[1] ?? libraryName.match(/(.)Client/)?.[1] ?? serviceTitle.match(/(.*) Service/)?.[1] ?? simpleServiceName;
return azureHuh
? simpleServiceName.startsWith("Azure")
? simpleServiceName
: Azure ${simpleServiceName}
: simpleServiceName;
}
function getClientName(model: RLCModel) {
const clientName = model.libraryName;
return clientName.endsWith("Client")
? ${clientName}
: ${clientName}Client
;
}
FAQs
In this library, we abstract the common generation logic for RLC generation from both swaggers and typespec. In this way, the autorest.typescript part will only need to transform the code model into RLCModel, and the TypeSpec emitter will only need to tra
The npm package @azure-tools/rlc-common receives a total of 938 weekly downloads. As such, @azure-tools/rlc-common popularity was classified as not popular.
We found that @azure-tools/rlc-common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.