Skip to content

[AutoPR @azure-rest/health-deidentification] Updated typespecs for sdk gen testing #11576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
807 changes: 404 additions & 403 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Release History

## 1.0.0-beta.1 (2024-08-15)

- Azure Deidentification client library for JS. This package contains Microsoft Azure Deidentification client library.

## 1.0.0-beta.1 (2024-08-27)

### Features Added

- Azure Deidentification client library for JS. This package contains Microsoft Azure Deidentification client library.
- Added Interface DeidServicesClientOptions
- Added Type Alias DeidServicesClient

60 changes: 9 additions & 51 deletions sdk/healthdataaiservices/azure-health-deidentification/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Azure Deidentification REST client library for JavaScript
# Azure DeidServices REST client library for JavaScript

`@azure-rest/health-deidentification` is a managed service that enables users to tag, redact, or surrogate health data.
Health Deidentification Service

**Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**

<!-- **Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library** -->
<!-- TODO Fix links once they are live use placeholden until then -->
Key links:

- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/health-deidentification)
- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure-rest/health-deidentification?view=azure-node-preview)

## Getting started

Expand All @@ -20,69 +21,26 @@ Key links:

### Install the `@azure-rest/health-deidentification` package

Install the Azure Deidentification REST client REST client library for JavaScript with `npm`:
Install the Azure DeidServices REST client REST client library for JavaScript with `npm`:

```bash
npm install @azure-rest/health-deidentification
```

### Create and authenticate a `DeidentificationClient`
### Create and authenticate a `DeidServicesClient`

To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
provide an instance of the desired credential type obtained from the
[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.

To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)

After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use.
As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#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`

Pull `ServiceUrl` from your created Deidentification Service.

![Service Url Location](documentation/images/ServiceUrl_Location.png)

Basic code snippet to create your Deidentification Client and Deidentify a string.

```javascript
import createClient, {
DeidentificationContent,
isUnexpected,
} from "@azure-rest/health-deidentification";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();

const credential = new DefaultAzureCredential();
const serviceEndpoint =
process.env["DEID_SERVICE_ENDPOINT"] || "https://example.api.cac001.deid.azure.com";
const client = createClient(serviceEndpoint, credential);

const content: DeidentificationContent = {
inputText: "Hello John!"
};

const response = await client.path("/deid").post({ body: content });

if (isUnexpected(response)) {
throw response.body.error;
}

console.log(response.body.outputText); // Hello, Tom!
```

## Key concept

Operation Modes:

- Tag: Will return a structure of offset and length with the PHI category of the related text spans.
- Redact: Will return output text with placeholder stubbed text. ex. `[name]`
- Surrogate: Will return output text with synthetic replacements.
- `My name is John Smith`
- `My name is Tom Jones`
AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./dist/esm/index.d.ts",
"docModel": { "enabled": true },
"apiReport": { "enabled": true, "reportFolder": "./review" },
"docModel": {
"enabled": true
},
"apiReport": {
"enabled": true,
"reportFolder": "./review"
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/health-deidentification.d.ts"
},
"messages": {
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
},
"extractorMessageReporting": {
"ae-missing-release-tag": { "logLevel": "none" },
"ae-unresolved-link": { "logLevel": "none" }
"ae-missing-release-tag": {
"logLevel": "none"
},
"ae-unresolved-link": {
"logLevel": "none"
}
}
}
}
}

This file was deleted.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import azsdkEslint from "@azure/eslint-plugin-azure-sdk";

export default [
...azsdkEslint.configs.recommended,
{
rules: {
"@azure/azure-sdk/ts-modules-only-named": "warn",
"@azure/azure-sdk/ts-apiextractor-json-types": "warn",
"@azure/azure-sdk/ts-package-json-types": "warn",
"@azure/azure-sdk/ts-package-json-engine-is-present": "warn",
"@azure/azure-sdk/ts-package-json-module": "off",
"@azure/azure-sdk/ts-package-json-files-required": "off",
"@azure/azure-sdk/ts-package-json-main-is-cjs": "off",
"tsdoc/syntax": "warn"
}
}
];
93 changes: 43 additions & 50 deletions sdk/healthdataaiservices/azure-health-deidentification/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@azure-rest/health-deidentification",
"version": "1.0.0-beta.1",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/azure-health-deidentification",
"description": "Health Deidentification Service",
"engines": {
"node": ">=18.0.0"
Expand Down Expand Up @@ -38,7 +37,8 @@
"dist",
"README.md",
"LICENSE",
"review/*"
"review/*",
"CHANGELOG.md"
],
"sdk-type": "client",
"repository": "github:Azure/azure-sdk-for-js",
Expand All @@ -49,99 +49,92 @@
"//metadata": {
"constantPaths": [
{
"path": "src/deidentificationClient.ts",
"prefix": "package-version"
"path": "src/deidServicesClient.ts",
"prefix": "userAgentInfo"
}
],
"sampleConfiguration": {
"skipFolder": false,
"disableDocsMs": true,
"productName": "Health Deidentification Service",
"productSlugs": [],
"apiRefLink": "https://docs.microsoft.com/javascript/api/",
"requiredResources": {
"De-identification Service": "https://docs.microsoft.com/javascript/api/"
}
}
]
},
"dependencies": {
"dotenv": "^16.0.0",
"@azure-rest/core-client": "^2.2.0",
"@azure-rest/core-client": "^2.1.0",
"@azure/core-auth": "^1.6.0",
"@azure/core-rest-pipeline": "^1.5.0",
"@azure/identity": "^4.4.0",
"@azure/logger": "^1.0.0",
"tslib": "^2.6.2",
"@azure/core-lro": "^3.0.0",
"@azure/abort-controller": "^2.0.0",
"@azure/core-paging": "^1.6.2"
"@azure/abort-controller": "^2.1.2",
"@azure/core-paging": "^1.5.0"
},
"devDependencies": {
"loupe": "~3.1.1",
"dotenv": "^16.0.0",
"@microsoft/api-extractor": "^7.40.3",
"@types/node": "^18.0.0",
"eslint": "^8.55.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"mkdirp": "^3.0.1",
"typescript": "~5.4.5",
"tshy": "^2.0.0",
"@azure/core-util": "^1.9.0",
"@azure-tools/test-credential": "^2.1.0",
"@azure-tools/test-recorder": "^4.1.0",
"typescript": "~5.5.3",
"tshy": "^1.11.1",
"@azure/core-util": "^1.0.0",
"@azure/identity": "^4.2.1",
"@vitest/browser": "^2.0.5",
"@vitest/coverage-istanbul": "^2.0.5",
"playwright": "^1.41.2",
"vitest": "^2.0.5",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0"
},
"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:node": "tshy",
"build:samples": "echo Obsolete.",
"build:test": "echo skipped. actual commands inlined in browser test scripts",
"build": "npm run clean && tshy && dev-tool run extract-api",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"",
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"execute:samples": "dev-tool samples run samples-dev",
"extract-api": "tshy && dev-tool run extract-api",
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples-dev/**/*.ts\"",
"generate:client": "autorest --typescript ./swagger/README.md",
"integration-test:browser": "tshy && dev-tool run build-test && dev-tool run test:vitest --browser",
"integration-test:node": "tshy && dev-tool run build-test && dev-tool run test:vitest",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]",
"extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api",
"pack": "npm pack 2>&1",
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
"test:node": "npm run clean && tshy && npm run unit-test:node",
"test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser",
"unit-test:browser": "npm run integration-test:browser",
"unit-test:node": "npm run integration-test:node",
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
"lint": "eslint package.json api-extractor.json src test",
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser",
"unit-test:node": "dev-tool run test:vitest",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "echo skipped",
"integration-test:node": "echo skipped",
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:samples": "echo skipped",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
"execute:samples": "echo skipped",
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
"generate:client": "echo skipped",
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"build:test": "npm run clean && tshy && dev-tool run build-test",
"build": "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api",
"test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node",
"test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test"
},
"exports": {
"./package.json": "./package.json",
".": {
"browser": {
"source": "./src/index.ts",
"types": "./dist/browser/index.d.ts",
"default": "./dist/browser/index.js"
},
"react-native": {
"source": "./src/index.ts",
"types": "./dist/react-native/index.d.ts",
"default": "./dist/react-native/index.js"
},
"import": {
"source": "./src/index.ts",
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"source": "./src/index.ts",
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
},
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"module": "./dist/esm/index.js"
}
"types": "./dist/commonjs/index.d.ts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface CancelJobHeaders {
export type CancelJobParameters = CancelJobHeaderParam & RequestParameters;

// @public
function createClient(endpointParam: string, credentials: TokenCredential, { apiVersion, ...options }?: DeidentificationClientOptions): DeidentificationClient;
function createClient(endpointParam: string, credentials: TokenCredential, { apiVersion, ...options }?: DeidServicesClientOptions): DeidServicesClient;
export default createClient;

// @public (undocumented)
Expand Down Expand Up @@ -149,16 +149,6 @@ export interface CreateJobLogicalResponse extends HttpResponse {
// @public (undocumented)
export type CreateJobParameters = CreateJobHeaderParam & CreateJobBodyParam & RequestParameters;

// @public (undocumented)
export type DeidentificationClient = Client & {
path: Routes;
};

// @public
export interface DeidentificationClientOptions extends ClientOptions {
apiVersion?: string;
}

// @public
export interface DeidentificationContent {
dataType?: DocumentDataType;
Expand Down Expand Up @@ -234,6 +224,16 @@ export interface DeidentifyDefaultResponse extends HttpResponse {
// @public (undocumented)
export type DeidentifyParameters = DeidentifyBodyParam & RequestParameters;

// @public (undocumented)
export type DeidServicesClient = Client & {
path: Routes;
};

// @public
export interface DeidServicesClientOptions extends ClientOptions {
apiVersion?: string;
}

// @public (undocumented)
export interface DeleteJob204Headers {
"x-ms-client-request-id"?: string;
Expand Down
Loading