@azure-rest/health-insights-cancerprofiling 1.0.0-alpha.20230818.1

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/README.md ADDED
@@ -0,0 +1,267 @@
1
+ # CancerProfiling REST client library for JavaScript
2
+
3
+ [Health Insights](https://learn.microsoft.com/azure/azure-health-insights/overview?branch=main) is an Azure Applied AI Service built with the Azure Cognitive Services Framework, that leverages multiple Cognitive Services, Healthcare API services and other Azure resources.
4
+ The [Cancer Profiling model](https://learn.microsoft.com/azure/azure-health-insights/oncophenotype/overview?branch=main) receives clinical records of oncology patients and outputs cancer staging, such as clinical stage TNM categories and pathologic stage TNM categories as well as tumor site, histology.
5
+
6
+ **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**
7
+
8
+ ## Getting started
9
+
10
+ ### Currently supported environments
11
+
12
+ - LTS versions of Node.js
13
+
14
+ ### Prerequisites
15
+
16
+ - LTS versions of Node.js
17
+ - You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package.
18
+ - An existing Cognitive Services Health Insights instance.
19
+
20
+ ### Install the `@azure-rest/health-insights-cancerprofiling` package
21
+
22
+ Install the CancerProfiling REST client library for JavaScript with `npm`:
23
+
24
+ ```bash
25
+ npm install @azure-rest/health-insights-cancerprofiling
26
+ ```
27
+
28
+ |SDK version|Supported API version of service |
29
+ |-------------|---------------|
30
+ |1.0.0-beta.1 | 2023-03-01-preview|
31
+
32
+ ### Create and authenticate a `CancerProfilingRestClient`
33
+
34
+ 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),
35
+ provide an instance of the desired credential type obtained from the
36
+ [@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
37
+
38
+ To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
39
+
40
+ 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.
41
+ As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
42
+ can be used to authenticate the client.
43
+
44
+ Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
45
+ AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
46
+
47
+ ## Key concepts
48
+
49
+ The Cancer Profiling model allows you to infer cancer attributes such as tumor site, histology, clinical stage TNM categories and pathologic stage TNM categories from unstructured clinical documents.
50
+
51
+ ## Examples
52
+ - [Infer Cancer Profiling](#cancer_profiling)
53
+
54
+ ```typescript
55
+ const apiKey = process.env["HEALTH_INSIGHTS_API_KEY"] || "";
56
+ const endpoint =
57
+ process.env["HEALTH_INSIGHTS_ENDPOINT"] || "";
58
+ const credential = new AzureKeyCredential(apiKey);
59
+ const client = CancerProfilingRestClient(endpoint, credential);
60
+
61
+ // Define patient information and clinical documents for the request body
62
+ const patientInfo = {
63
+ sex: "FEMALE",
64
+ birthDate: new Date("1979-10-08T00:00:00.000Z"), // Note: Months are zero-based (11 represents December)
65
+ };
66
+
67
+ const doc1 = "15.8.2021"
68
+ "Jane Doe 091175-8967"
69
+ "42 year old female, married with 3 children, works as a nurse. "
70
+ "Healthy, no medications taken on a regular basis."
71
+ "PMHx is significant for migraines with aura, uses Mirena for contraception."
72
+ "Smoking history of 10 pack years (has stopped and relapsed several times)."
73
+ "She is in c/o 2 weeks of productive cough and shortness of breath."
74
+ "She has a fever of 37.8 and general weakness. "
75
+ "Denies night sweats and rash. She denies symptoms of rhinosinusitis, asthma, and heartburn. "
76
+ "On PE:"
77
+ "GENERAL: mild pallor, no cyanosis. Regular breathing rate. "
78
+ "LUNGS: decreased breath sounds on the base of the right lung. Vesicular breathing."
79
+ " No crackles, rales, and wheezes. Resonant percussion. "
80
+ "PLAN: "
81
+ "Will be referred for a chest x-ray. "
82
+ "======================================"
83
+ "CXR showed mild nonspecific opacities in right lung base. "
84
+ "PLAN:"
85
+ "Findings are suggestive of a working diagnosis of pneumonia. The patient is referred to a "
86
+ "follow-up CXR in 2 weeks. ";
87
+
88
+ const docContent = {
89
+ sourceType: "INLINE",
90
+ value: doc1
91
+ };
92
+
93
+ const patientDoc1 = {
94
+ type: "NOTE",
95
+ id: "doc1",
96
+ content: docContent,
97
+ clinicalType: "IMAGING",
98
+ language: "en",
99
+ createdDateTime: new Date("2021-15-08T00:00:00.000Z")
100
+ };
101
+
102
+ const doc1 = `15.8.2021
103
+ Jane Doe 091175-8967
104
+ 42 year old female, married with 3 children, works as a nurse.
105
+ Healthy, no medications taken on a regular basis.
106
+ PMHx is significant for migraines with aura, uses Mirena for contraception.
107
+ Smoking history of 10 pack years (has stopped and relapsed several times).
108
+ She is in c/o 2 weeks of productive cough and shortness of breath.
109
+ She has a fever of 37.8 and general weakness.
110
+ Denies night sweats and rash. She denies symptoms of rhinosinusitis, asthma, and heartburn.
111
+ On PE:
112
+ GENERAL: mild pallor, no cyanosis. Regular breathing rate.
113
+ LUNGS: decreased breath sounds on the base of the right lung. Vesicular breathing.
114
+ No crackles, rales, and wheezes. Resonant percussion.
115
+ PLAN:
116
+ Will be referred for a chest x-ray.
117
+ ======================================
118
+ CXR showed mild nonspecific opacities in right lung base.
119
+ PLAN:
120
+ Findings are suggestive of a working diagnosis of pneumonia. The patient is referred to a
121
+ follow-up CXR in 2 weeks. `;
122
+
123
+ const docContent = {
124
+ sourceType: "INLINE",
125
+ value: doc1
126
+ };
127
+
128
+ const patientDoc1 = {
129
+ type: "NOTE",
130
+ id: "doc1",
131
+ content: docContent,
132
+ clinicalType: "IMAGING",
133
+ language: "en",
134
+ createdDateTime: new Date("2021-15-08T00:00:00.000Z")
135
+ };
136
+
137
+ const doc2 = `Oncology Clinic
138
+ 20.10.2021
139
+ Jane Doe 091175-8967
140
+ 42-year-old healthy female who works as a nurse in the ER of this hospital.
141
+ First menstruation at 11 years old. First delivery- 27 years old. She has 3 children.
142
+ Didn’t breastfeed.
143
+ Contraception- Mirena.
144
+ Smoking- 10 pack years.
145
+ Mother- Belarusian. Father- Georgian.
146
+ About 3 months prior to admission, she stated she had SOB and was febrile.
147
+ She did a CXR as an outpatient which showed a finding in the base of the right lung-
148
+ possibly an infiltrate.
149
+ She was treated with antibiotics with partial response.
150
+ 6 weeks later a repeat CXR was performed- a few solid dense findings in the right lung.
151
+ Therefore, she was referred for a PET-CT which demonstrated increased uptake in the right
152
+ breast, lymph nodes on the right a few areas in the lungs and liver.
153
+ On biopsy from the lesion in the right breast- triple negative adenocarcinoma. Genetic
154
+ testing has not been done thus far.
155
+ Genetic counseling- the patient denies a family history of breast, ovary, uterus,
156
+ and prostate cancer. Her mother has chronic lymphocytic leukemia (CLL).
157
+ She is planned to undergo genetic tests because the aggressive course of the disease,
158
+ and her young age.
159
+ Impression:
160
+ Stage 4 triple negative breast adenocarcinoma.
161
+ Could benefit from biological therapy.
162
+ Different treatment options were explained- the patient wants to get a second opinion.`;
163
+
164
+ const docContent2 = {
165
+ sourceType: "INLINE",
166
+ value: doc2
167
+ };
168
+
169
+ const patientDoc2 = {
170
+ type: "NOTE",
171
+ id: "doc2",
172
+ content: docContent3,
173
+ clinicalType: "PATHOLOGY",
174
+ language: "en",
175
+ createdDateTime: new Date("2022-01-01T00:00:00.000Z")
176
+ };
177
+
178
+ const patient1 = {
179
+ id: "patient_id",
180
+ info: patientInfo,
181
+ data: [patientDoc1, patientDoc2]
182
+ };
183
+
184
+ const cancerProfilingData: OncoPhenotypeData = {
185
+ patients: [patient1],
186
+ configuration: {includeEvidence: true}
187
+ };
188
+
189
+ const parameters = {
190
+ body: cancerProfilingData
191
+ };
192
+
193
+ // Initiate cancer profiling job and retrieve results
194
+ const initialResponse = await client.path("/oncophenotype/jobs").post(parameters);
195
+ if (isUnexpected(initialResponse)) {
196
+ throw initialResponse;
197
+ }
198
+ const poller = await getLongRunningPoller(client, initialResponse);
199
+ const cancerProfilingResult = await poller.pollUntilDone();
200
+ if (isUnexpected(cancerProfilingResult)) {
201
+ throw cancerProfilingResult;
202
+ }
203
+ const resultBody = cancerProfilingResult.body;
204
+ // Print the inference results for a patient's cancer attributes
205
+ if (cancerProfilingResult.status === "succeeded") {
206
+ const results = cancerProfilingResult.results;
207
+ if (results) {
208
+ for (const patientResult of results.patients) {
209
+ console.log(`Inferences of Patient ${patientResult.id}`);
210
+ for (const { type, value, confidenceScore, evidence } of patientResult.inferences) {
211
+ console.log(`Clinical Type: ${String(type)} Value: ${value}, ConfidenceScore: ${confidenceScore}`);
212
+ for (const { patientDataEvidence } of evidence || []) {
213
+ if (patientDataEvidence) {
214
+ console.log(`Evidence: ${patientDataEvidence.id} ${patientDataEvidence.offset} ${patientDataEvidence.length} ${patientDataEvidence.text}`);
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ } else {
221
+ const errors = cancerProfilingResult.errors;
222
+ if (errors) {
223
+ for (const error of errors) {
224
+ console.log(error.code, ":", error.message);
225
+ }
226
+ }
227
+ }
228
+ ```
229
+
230
+ ## Troubleshooting
231
+
232
+ ### Logging
233
+
234
+ 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`:
235
+
236
+ ```javascript
237
+ const { setLogLevel } = require("@azure/logger");
238
+
239
+ setLogLevel("info");
240
+ ```
241
+
242
+ For more detailed instructions on how to enable logs, you can look at the [@azure/logger](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger) package docs.
243
+
244
+ ## Next steps
245
+
246
+ This code sample show common scenario operation with the Azure Health Insights Cancer Profiling library. More samples can be found under the [samples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-cancerprofiling-rest/samples/v1-beta/typescript/src/) directory.
247
+ - Infer Cancer Profiling: [sample_infer_cancer_profiling.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthinsights/health-insights-cancerprofiling-rest/samples/v1-beta/typescript/src/sample_infer_cancer_profiling.ts)
248
+
249
+
250
+ ### Additional documentation
251
+
252
+ For more extensive documentation on Azure Health Insights Cancer Profiling, see the [Cancer Profiling documentation](https://learn.microsoft.com/azure/azure-health-insights/oncophenotype/overview) on docs.microsoft.com.
253
+
254
+
255
+ ## Contributing
256
+
257
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].
258
+
259
+ When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
260
+
261
+ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.
262
+
263
+ <!-- LINKS -->
264
+ [cla]: https://cla.microsoft.com
265
+ [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
266
+ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
267
+ [coc_contact]: mailto:opencode@microsoft.com
package/dist/index.js ADDED
@@ -0,0 +1,157 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var coreClient = require('@azure-rest/core-client');
6
+ var logger$1 = require('@azure/logger');
7
+ var coreLro = require('@azure/core-lro');
8
+
9
+ // Copyright (c) Microsoft Corporation.
10
+ const logger = logger$1.createClientLogger("health-insights-cancerprofiling");
11
+
12
+ // Copyright (c) Microsoft Corporation.
13
+ /**
14
+ * Initialize a new instance of `CancerProfilingRestClient`
15
+ * @param endpoint - Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
16
+ * @param credentials - uniquely identify client credential
17
+ * @param options - the parameter for all optional parameters
18
+ */
19
+ function createClient(endpoint, credentials, options = {}) {
20
+ var _a, _b, _c, _d, _e, _f;
21
+ const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}/healthinsights`;
22
+ options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2023-03-01-preview";
23
+ options = Object.assign(Object.assign({}, options), { credentials: {
24
+ apiKeyHeaderName: (_d = (_c = options.credentials) === null || _c === void 0 ? void 0 : _c.apiKeyHeaderName) !== null && _d !== void 0 ? _d : "Ocp-Apim-Subscription-Key",
25
+ } });
26
+ const userAgentInfo = `azsdk-js-health-insights-cancerprofiling-rest/1.0.0-beta.1`;
27
+ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
28
+ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
29
+ : `${userAgentInfo}`;
30
+ options = Object.assign(Object.assign({}, options), { userAgentOptions: {
31
+ userAgentPrefix,
32
+ }, loggingOptions: {
33
+ logger: (_f = (_e = options.loggingOptions) === null || _e === void 0 ? void 0 : _e.logger) !== null && _f !== void 0 ? _f : logger.info,
34
+ } });
35
+ const client = coreClient.getClient(baseUrl, credentials, options);
36
+ return client;
37
+ }
38
+
39
+ // Copyright (c) Microsoft Corporation.
40
+ // Licensed under the MIT license.
41
+ const responseMap = {
42
+ "GET /oncophenotype/jobs/{jobId}": ["200"],
43
+ "POST /oncophenotype/jobs": ["200", "202"],
44
+ "GET /oncophenotype/jobs": ["200", "202"],
45
+ };
46
+ function isUnexpected(response) {
47
+ const lroOriginal = response.headers["x-ms-original-url"];
48
+ const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
49
+ const method = response.request.method;
50
+ let pathDetails = responseMap[`${method} ${url.pathname}`];
51
+ if (!pathDetails) {
52
+ pathDetails = getParametrizedPathSuccess(method, url.pathname);
53
+ }
54
+ return !pathDetails.includes(response.status);
55
+ }
56
+ function getParametrizedPathSuccess(method, path) {
57
+ var _a, _b, _c, _d;
58
+ const pathParts = path.split("/");
59
+ // Traverse list to match the longest candidate
60
+ // matchedLen: the length of candidate path
61
+ // matchedValue: the matched status code array
62
+ let matchedLen = -1, matchedValue = [];
63
+ // Iterate the responseMap to find a match
64
+ for (const [key, value] of Object.entries(responseMap)) {
65
+ // Extracting the path from the map key which is in format
66
+ // GET /path/foo
67
+ if (!key.startsWith(method)) {
68
+ continue;
69
+ }
70
+ const candidatePath = getPathFromMapKey(key);
71
+ // Get each part of the url path
72
+ const candidateParts = candidatePath.split("/");
73
+ // track if we have found a match to return the values found.
74
+ let found = true;
75
+ for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
76
+ if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
77
+ const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
78
+ // If the current part of the candidate is a "template" part
79
+ // Try to use the suffix of pattern to match the path
80
+ // {guid} ==> $
81
+ // {guid}:export ==> :export$
82
+ const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
83
+ if (!isMatched) {
84
+ found = false;
85
+ break;
86
+ }
87
+ continue;
88
+ }
89
+ // If the candidate part is not a template and
90
+ // the parts don't match mark the candidate as not found
91
+ // to move on with the next candidate path.
92
+ if (candidateParts[i] !== pathParts[j]) {
93
+ found = false;
94
+ break;
95
+ }
96
+ }
97
+ // We finished evaluating the current candidate parts
98
+ // Update the matched value if and only if we found the longer pattern
99
+ if (found && candidatePath.length > matchedLen) {
100
+ matchedLen = candidatePath.length;
101
+ matchedValue = value;
102
+ }
103
+ }
104
+ return matchedValue;
105
+ }
106
+ function getPathFromMapKey(mapKey) {
107
+ const pathStart = mapKey.indexOf("/");
108
+ return mapKey.slice(pathStart);
109
+ }
110
+
111
+ // Copyright (c) Microsoft Corporation.
112
+ async function getLongRunningPoller(client, initialResponse, options = {}) {
113
+ var _a;
114
+ const poller = {
115
+ requestMethod: initialResponse.request.method,
116
+ requestPath: initialResponse.request.url,
117
+ sendInitialRequest: async () => {
118
+ // In the case of Rest Clients we are building the LRO poller object from a response that's the reason
119
+ // we are not triggering the initial request here, just extracting the information from the
120
+ // response we were provided.
121
+ return getLroResponse(initialResponse);
122
+ },
123
+ sendPollRequest: async (path) => {
124
+ // This is the callback that is going to be called to poll the service
125
+ // to get the latest status. We use the client provided and the polling path
126
+ // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
127
+ // depending on the lro pattern that the service implements. If non is provided we default to the initial path.
128
+ const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
129
+ const lroResponse = getLroResponse(response);
130
+ lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
131
+ return lroResponse;
132
+ },
133
+ };
134
+ options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true;
135
+ return coreLro.createHttpPoller(poller, options);
136
+ }
137
+ /**
138
+ * Converts a Rest Client response to a response that the LRO implementation understands
139
+ * @param response - a rest client http response
140
+ * @returns - An LRO response that the LRO implementation understands
141
+ */
142
+ function getLroResponse(response) {
143
+ if (Number.isNaN(response.status)) {
144
+ throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
145
+ }
146
+ return {
147
+ flatResponse: response,
148
+ rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
149
+ };
150
+ }
151
+
152
+ // Copyright (c) Microsoft Corporation.
153
+
154
+ exports["default"] = createClient;
155
+ exports.getLongRunningPoller = getLongRunningPoller;
156
+ exports.isUnexpected = isUnexpected;
157
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/logger.ts","../src/cancerProfilingRest.ts","../src/isUnexpected.ts","../src/pollingHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"health-insights-cancerprofiling\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { CancerProfilingRestClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `CancerProfilingRestClient`\n * @param endpoint - Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credentials: KeyCredential,\n options: ClientOptions = {}\n): CancerProfilingRestClient {\n const baseUrl = options.baseUrl ?? `${endpoint}/healthinsights`;\n options.apiVersion = options.apiVersion ?? \"2023-03-01-preview\";\n options = {\n ...options,\n credentials: {\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n\n const userAgentInfo = `azsdk-js-health-insights-cancerprofiling-rest/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n };\n\n const client = getClient(baseUrl, credentials, options) as CancerProfilingRestClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetJob200Response,\n GetJobDefaultResponse,\n CreateJob200Response,\n CreateJob202Response,\n CreateJobLogicalResponse,\n CreateJobDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /oncophenotype/jobs/{jobId}\": [\"200\"],\n \"POST /oncophenotype/jobs\": [\"200\", \"202\"],\n \"GET /oncophenotype/jobs\": [\"200\", \"202\"],\n};\n\nexport function isUnexpected(\n response: GetJob200Response | GetJobDefaultResponse\n): response is GetJobDefaultResponse;\nexport function isUnexpected(\n response:\n | CreateJob200Response\n | CreateJob202Response\n | CreateJobLogicalResponse\n | CreateJobDefaultResponse\n): response is CreateJobDefaultResponse;\nexport function isUnexpected(\n response:\n | GetJob200Response\n | GetJobDefaultResponse\n | CreateJob200Response\n | CreateJob202Response\n | CreateJobLogicalResponse\n | CreateJobDefaultResponse\n): response is GetJobDefaultResponse | CreateJobDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\"\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport {\n CreateHttpPollerOptions,\n LongRunningOperation,\n LroResponse,\n OperationState,\n SimplePollerLike,\n createHttpPoller,\n} from \"@azure/core-lro\";\nimport {\n CreateJob200Response,\n CreateJob202Response,\n CreateJobDefaultResponse,\n CreateJobLogicalResponse,\n} from \"./responses\";\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<\n TResult extends CreateJobLogicalResponse | CreateJobDefaultResponse\n>(\n client: Client,\n initialResponse: CreateJob200Response | CreateJob202Response | CreateJobDefaultResponse,\n options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {}\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const poller: LongRunningOperation<TResult> = {\n requestMethod: initialResponse.request.method,\n requestPath: initialResponse.request.url,\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n const response = await client.pathUnchecked(path ?? initialResponse.request.url).get();\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n return createHttpPoller(poller, options);\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(response: TResult): LroResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport CancerProfilingRest from \"./cancerProfilingRest\";\n\nexport * from \"./cancerProfilingRest\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./pollingHelper\";\n\nexport default CancerProfilingRest;\n"],"names":["createClientLogger","getClient","createHttpPoller"],"mappings":";;;;;;;;AAAA;AAIO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,iCAAiC,CAAC;;ACJ3E;AAQA;;;;;AAKG;AACW,SAAU,YAAY,CAClC,QAAgB,EAChB,WAA0B,EAC1B,OAAA,GAAyB,EAA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client";
4
+ import { logger } from "./logger";
5
+ /**
6
+ * Initialize a new instance of `CancerProfilingRestClient`
7
+ * @param endpoint - Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
8
+ * @param credentials - uniquely identify client credential
9
+ * @param options - the parameter for all optional parameters
10
+ */
11
+ export default function createClient(endpoint, credentials, options = {}) {
12
+ var _a, _b, _c, _d, _e, _f;
13
+ const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}/healthinsights`;
14
+ options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2023-03-01-preview";
15
+ options = Object.assign(Object.assign({}, options), { credentials: {
16
+ apiKeyHeaderName: (_d = (_c = options.credentials) === null || _c === void 0 ? void 0 : _c.apiKeyHeaderName) !== null && _d !== void 0 ? _d : "Ocp-Apim-Subscription-Key",
17
+ } });
18
+ const userAgentInfo = `azsdk-js-health-insights-cancerprofiling-rest/1.0.0-beta.1`;
19
+ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
20
+ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
21
+ : `${userAgentInfo}`;
22
+ options = Object.assign(Object.assign({}, options), { userAgentOptions: {
23
+ userAgentPrefix,
24
+ }, loggingOptions: {
25
+ logger: (_f = (_e = options.loggingOptions) === null || _e === void 0 ? void 0 : _e.logger) !== null && _f !== void 0 ? _f : logger.info,
26
+ } });
27
+ const client = getClient(baseUrl, credentials, options);
28
+ return client;
29
+ }
30
+ //# sourceMappingURL=cancerProfilingRest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancerProfilingRest.js","sourceRoot":"","sources":["../../src/cancerProfilingRest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,QAAgB,EAChB,WAA0B,EAC1B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,QAAQ,iBAAiB,CAAC;IAChE,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,oBAAoB,CAAC;IAChE,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IAEF,MAAM,aAAa,GAAG,4DAA4D,CAAC;IACnF,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAA8B,CAAC;IAErF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { KeyCredential } from \"@azure/core-auth\";\nimport { CancerProfilingRestClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `CancerProfilingRestClient`\n * @param endpoint - Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credentials: KeyCredential,\n options: ClientOptions = {}\n): CancerProfilingRestClient {\n const baseUrl = options.baseUrl ?? `${endpoint}/healthinsights`;\n options.apiVersion = options.apiVersion ?? \"2023-03-01-preview\";\n options = {\n ...options,\n credentials: {\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n\n const userAgentInfo = `azsdk-js-health-insights-cancerprofiling-rest/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n };\n\n const client = getClient(baseUrl, credentials, options) as CancerProfilingRestClient;\n\n return client;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=clientDefinitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { GetJobParameters, CreateJobParameters } from \"./parameters\";\nimport {\n GetJob200Response,\n GetJobDefaultResponse,\n CreateJob200Response,\n CreateJob202Response,\n CreateJobDefaultResponse,\n} from \"./responses\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface GetJob {\n /** Gets the status and details of the Onco Phenotype job. */\n get(options?: GetJobParameters): StreamableMethod<GetJob200Response | GetJobDefaultResponse>;\n}\n\nexport interface CreateJob {\n /** Creates an Onco Phenotype job with the given request body. */\n post(\n options?: CreateJobParameters\n ): StreamableMethod<CreateJob200Response | CreateJob202Response | CreateJobDefaultResponse>;\n}\n\nexport interface Routes {\n /** Resource for '/oncophenotype/jobs/\\{jobId\\}' has methods for the following verbs: get */\n (path: \"/oncophenotype/jobs/{jobId}\", jobId: string): GetJob;\n /** Resource for '/oncophenotype/jobs' has methods for the following verbs: post */\n (path: \"/oncophenotype/jobs\"): CreateJob;\n}\n\nexport type CancerProfilingRestClient = Client & {\n path: Routes;\n};\n"]}
@@ -0,0 +1,13 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import CancerProfilingRest from "./cancerProfilingRest";
4
+ export * from "./cancerProfilingRest";
5
+ export * from "./parameters";
6
+ export * from "./responses";
7
+ export * from "./clientDefinitions";
8
+ export * from "./isUnexpected";
9
+ export * from "./models";
10
+ export * from "./outputModels";
11
+ export * from "./pollingHelper";
12
+ export default CancerProfilingRest;
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAExD,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAEhC,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport CancerProfilingRest from \"./cancerProfilingRest\";\n\nexport * from \"./cancerProfilingRest\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./pollingHelper\";\n\nexport default CancerProfilingRest;\n"]}
@@ -0,0 +1,72 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ const responseMap = {
4
+ "GET /oncophenotype/jobs/{jobId}": ["200"],
5
+ "POST /oncophenotype/jobs": ["200", "202"],
6
+ "GET /oncophenotype/jobs": ["200", "202"],
7
+ };
8
+ export function isUnexpected(response) {
9
+ const lroOriginal = response.headers["x-ms-original-url"];
10
+ const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
11
+ const method = response.request.method;
12
+ let pathDetails = responseMap[`${method} ${url.pathname}`];
13
+ if (!pathDetails) {
14
+ pathDetails = getParametrizedPathSuccess(method, url.pathname);
15
+ }
16
+ return !pathDetails.includes(response.status);
17
+ }
18
+ function getParametrizedPathSuccess(method, path) {
19
+ var _a, _b, _c, _d;
20
+ const pathParts = path.split("/");
21
+ // Traverse list to match the longest candidate
22
+ // matchedLen: the length of candidate path
23
+ // matchedValue: the matched status code array
24
+ let matchedLen = -1, matchedValue = [];
25
+ // Iterate the responseMap to find a match
26
+ for (const [key, value] of Object.entries(responseMap)) {
27
+ // Extracting the path from the map key which is in format
28
+ // GET /path/foo
29
+ if (!key.startsWith(method)) {
30
+ continue;
31
+ }
32
+ const candidatePath = getPathFromMapKey(key);
33
+ // Get each part of the url path
34
+ const candidateParts = candidatePath.split("/");
35
+ // track if we have found a match to return the values found.
36
+ let found = true;
37
+ for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
38
+ if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
39
+ const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
40
+ // If the current part of the candidate is a "template" part
41
+ // Try to use the suffix of pattern to match the path
42
+ // {guid} ==> $
43
+ // {guid}:export ==> :export$
44
+ const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
45
+ if (!isMatched) {
46
+ found = false;
47
+ break;
48
+ }
49
+ continue;
50
+ }
51
+ // If the candidate part is not a template and
52
+ // the parts don't match mark the candidate as not found
53
+ // to move on with the next candidate path.
54
+ if (candidateParts[i] !== pathParts[j]) {
55
+ found = false;
56
+ break;
57
+ }
58
+ }
59
+ // We finished evaluating the current candidate parts
60
+ // Update the matched value if and only if we found the longer pattern
61
+ if (found && candidatePath.length > matchedLen) {
62
+ matchedLen = candidatePath.length;
63
+ matchedValue = value;
64
+ }
65
+ }
66
+ return matchedValue;
67
+ }
68
+ function getPathFromMapKey(mapKey) {
69
+ const pathStart = mapKey.indexOf("/");
70
+ return mapKey.slice(pathStart);
71
+ }
72
+ //# sourceMappingURL=isUnexpected.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAWlC,MAAM,WAAW,GAA6B;IAC5C,iCAAiC,EAAE,CAAC,KAAK,CAAC;IAC1C,0BAA0B,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IAC1C,yBAAyB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;CAC1C,CAAC;AAYF,MAAM,UAAU,YAAY,CAC1B,QAM4B;IAE5B,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;IACvC,IAAI,WAAW,GAAG,WAAW,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,WAAW,EAAE;QAChB,WAAW,GAAG,0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G,CAAC,GAAG,CAAC,EAC/C,GAAG,GAAG,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAC;gBAClC,4DAA4D;gBAC5D,qDAAqD;gBACrD,eAAe;gBACf,6BAA6B;gBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,GAAG,MAAA,cAAc,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAC1E,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CACnB,CAAC;gBAEF,IAAI,CAAC,SAAS,EAAE;oBACd,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;iBACP;gBACD,SAAS;aACV;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE;gBACtC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;aACP;SACF;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE;YAC9C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;SACtB;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetJob200Response,\n GetJobDefaultResponse,\n CreateJob200Response,\n CreateJob202Response,\n CreateJobLogicalResponse,\n CreateJobDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /oncophenotype/jobs/{jobId}\": [\"200\"],\n \"POST /oncophenotype/jobs\": [\"200\", \"202\"],\n \"GET /oncophenotype/jobs\": [\"200\", \"202\"],\n};\n\nexport function isUnexpected(\n response: GetJob200Response | GetJobDefaultResponse\n): response is GetJobDefaultResponse;\nexport function isUnexpected(\n response:\n | CreateJob200Response\n | CreateJob202Response\n | CreateJobLogicalResponse\n | CreateJobDefaultResponse\n): response is CreateJobDefaultResponse;\nexport function isUnexpected(\n response:\n | GetJob200Response\n | GetJobDefaultResponse\n | CreateJob200Response\n | CreateJob202Response\n | CreateJobLogicalResponse\n | CreateJobDefaultResponse\n): response is GetJobDefaultResponse | CreateJobDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\"\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
@@ -0,0 +1,5 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { createClientLogger } from "@azure/logger";
4
+ export const logger = createClientLogger("health-insights-cancerprofiling");
5
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,iCAAiC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"health-insights-cancerprofiling\");\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** A piece of clinical information, expressed as a code in a clinical coding system. */\nexport interface ClinicalCodedElement {\n /** The clinical coding system, e.g. ICD-10, SNOMED-CT, UMLS. */\n system: string;\n /** The code within the given clinical coding system. */\n code: string;\n /** The name of this coded concept in the coding system. */\n name?: string;\n /** A value associated with the code within the given clinical coding system. */\n value?: string;\n}\n\n/** The body of the Onco Phenotype request. */\nexport interface OncoPhenotypeData {\n /** The list of patients, including their clinical information and data. */\n patients: Array<PatientRecord>;\n /** Configuration affecting the Onco Phenotype model's inference. */\n configuration?: OncoPhenotypeModelConfiguration;\n}\n\n/** A patient record, including their clinical information and data. */\nexport interface PatientRecord {\n /** A given identifier for the patient. Has to be unique across all patients in a single request. */\n id: string;\n /** Patient structured information, including demographics and known structured clinical information. */\n info?: PatientInfo;\n /** Patient unstructured clinical data, given as documents. */\n data?: Array<PatientDocument>;\n}\n\n/** Patient structured information, including demographics and known structured clinical information. */\nexport interface PatientInfo {\n /**\n * The patient's sex.\n *\n * Possible values: female, male, unspecified\n */\n sex?: string;\n /** The patient's date of birth. */\n birthDate?: Date | string;\n /** Known clinical information for the patient, structured. */\n clinicalInfo?: Array<ClinicalCodedElement>;\n}\n\n/** A clinical document related to a patient. Document here is in the wide sense - not just a text document (note). */\nexport interface PatientDocument {\n /**\n * The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document).\n *\n * Possible values: note, fhirBundle, dicom, genomicSequencing\n */\n type: string;\n /**\n * The type of the clinical document.\n *\n * Possible values: consultation, dischargeSummary, historyAndPhysical, procedure, progress, imaging, laboratory, pathology\n */\n clinicalType?: string;\n /** A given identifier for the document. Has to be unique across all documents for a single patient. */\n id: string;\n /** A 2 letter ISO 639-1 representation of the language of the document. */\n language?: string;\n /** The date and time when the document was created. */\n createdDateTime?: Date | string;\n /** The content of the patient document. */\n content: DocumentContent;\n}\n\n/** The content of the patient document. */\nexport interface DocumentContent {\n /**\n * The type of the content's source.\n * In case the source type is 'inline', the content is given as a string (for instance, text).\n * In case the source type is 'reference', the content is given as a URI.\n *\n * Possible values: inline, reference\n */\n sourceType: string;\n /** The content of the document, given either inline (as a string) or as a reference (URI). */\n value: string;\n}\n\n/** Configuration affecting the Onco Phenotype model's inference. */\nexport interface OncoPhenotypeModelConfiguration {\n /** An indication whether the model should produce verbose output. */\n verbose?: boolean;\n /** An indication whether the model's output should include evidence for the inferences. */\n includeEvidence?: boolean;\n /**\n * A list of inference types to be inferred for the current request.\n * This could be used if only part of the Onco Phenotype inferences are required.\n * If this list is omitted or empty, the model will return all the inference types.\n */\n inferenceTypes?: string[];\n /** An indication whether to perform a preliminary step on the patient's documents to determine whether they relate to a Cancer case. */\n checkForCancerCase?: boolean;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=outputModels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** The response for the Onco Phenotype request. */\nexport interface OncoPhenotypeResultOutput {\n /** A processing job identifier. */\n readonly jobId: string;\n /** The date and time when the processing job was created. */\n readonly createdDateTime: string;\n /** The date and time when the processing job is set to expire. */\n readonly expirationDateTime: string;\n /** The date and time when the processing job was last updated. */\n readonly lastUpdateDateTime: string;\n /**\n * The status of the processing job.\n *\n * Possible values: notStarted, running, succeeded, failed, partiallyCompleted\n */\n readonly status: string;\n /** An array of errors, if any errors occurred during the processing job. */\n readonly errors?: Array<ErrorModelOutput>;\n /** The inference results for the Onco Phenotype request. */\n readonly results?: OncoPhenotypeResultsOutput;\n}\n\n/** The error object. */\nexport interface ErrorModelOutput {\n /** One of a server-defined set of error codes. */\n code: string;\n /** A human-readable representation of the error. */\n message: string;\n /** The target of the error. */\n target?: string;\n /** An array of details about specific errors that led to this reported error. */\n details?: Array<ErrorModelOutput>;\n /** An object containing more specific information than the current object about the error. */\n innererror?: InnerErrorOutput;\n}\n\n/** An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. */\nexport interface InnerErrorOutput {\n /** One of a server-defined set of error codes. */\n code?: string;\n /** Inner error. */\n innererror?: InnerErrorOutput;\n}\n\n/** The inference results for the Onco Phenotype request. */\nexport interface OncoPhenotypeResultsOutput {\n /** Results for the patients given in the request. */\n patients: Array<OncoPhenotypePatientResultOutput>;\n /** The version of the model used for inference, expressed as the model date. */\n modelVersion: string;\n}\n\n/** The results of the model's work for a single patient. */\nexport interface OncoPhenotypePatientResultOutput {\n /** The identifier given for the patient in the request. */\n id: string;\n /** The model's inferences for the given patient. */\n inferences: Array<OncoPhenotypeInferenceOutput>;\n}\n\n/** An inference made by the Onco Phenotype model regarding a patient. */\nexport interface OncoPhenotypeInferenceOutput {\n /**\n * The type of the Onco Phenotype inference\n *\n * Possible values: tumorSite, histology, clinicalStageT, clinicalStageN, clinicalStageM, pathologicStageT, pathologicStageN, pathologicStageM\n */\n type: string;\n /** The value of the inference, as relevant for the given inference type. */\n value: string;\n /** The description corresponding to the inference value. */\n description?: string;\n /** Confidence score for this inference. */\n confidenceScore?: number;\n /** The evidence corresponding to the inference value. */\n evidence?: Array<InferenceEvidenceOutput>;\n /** An identifier for a clinical case, if there are multiple clinical cases regarding the same patient. */\n caseId?: string;\n}\n\n/** A piece of evidence corresponding to an inference. */\nexport interface InferenceEvidenceOutput {\n /** A piece of evidence from a clinical note (text document). */\n patientDataEvidence?: ClinicalNoteEvidenceOutput;\n /**\n * A piece of clinical information, expressed as a code in a clinical coding\n * system.\n */\n patientInfoEvidence?: ClinicalCodedElementOutput;\n /** A value indicating how important this piece of evidence is for the inference. */\n importance?: number;\n}\n\n/** A piece of evidence from a clinical note (text document). */\nexport interface ClinicalNoteEvidenceOutput {\n /** The identifier of the document containing the evidence. */\n id: string;\n /** The actual text span which is evidence for the inference. */\n text?: string;\n /** The start index of the evidence text span in the document (0 based). */\n offset: number;\n /** The length of the evidence text span. */\n length: number;\n}\n\n/** A piece of clinical information, expressed as a code in a clinical coding system. */\nexport interface ClinicalCodedElementOutput {\n /** The clinical coding system, e.g. ICD-10, SNOMED-CT, UMLS. */\n system: string;\n /** The code within the given clinical coding system. */\n code: string;\n /** The name of this coded concept in the coding system. */\n name?: string;\n /** A value associated with the code within the given clinical coding system. */\n value?: string;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport { OncoPhenotypeData } from \"./models\";\n\nexport type GetJobParameters = RequestParameters;\n\nexport interface CreateJobHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"Repeatability-Request-ID\"?: string;\n /** Specifies the date and time at which the request was first created. */\n \"Repeatability-First-Sent\"?: string;\n}\n\nexport interface CreateJobBodyParam {\n body?: OncoPhenotypeData;\n}\n\nexport interface CreateJobHeaderParam {\n headers?: RawHttpHeadersInput & CreateJobHeaders;\n}\n\nexport type CreateJobParameters = CreateJobHeaderParam & CreateJobBodyParam & RequestParameters;\n"]}
@@ -0,0 +1,43 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { createHttpPoller, } from "@azure/core-lro";
4
+ export async function getLongRunningPoller(client, initialResponse, options = {}) {
5
+ var _a;
6
+ const poller = {
7
+ requestMethod: initialResponse.request.method,
8
+ requestPath: initialResponse.request.url,
9
+ sendInitialRequest: async () => {
10
+ // In the case of Rest Clients we are building the LRO poller object from a response that's the reason
11
+ // we are not triggering the initial request here, just extracting the information from the
12
+ // response we were provided.
13
+ return getLroResponse(initialResponse);
14
+ },
15
+ sendPollRequest: async (path) => {
16
+ // This is the callback that is going to be called to poll the service
17
+ // to get the latest status. We use the client provided and the polling path
18
+ // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
19
+ // depending on the lro pattern that the service implements. If non is provided we default to the initial path.
20
+ const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
21
+ const lroResponse = getLroResponse(response);
22
+ lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
23
+ return lroResponse;
24
+ },
25
+ };
26
+ options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true;
27
+ return createHttpPoller(poller, options);
28
+ }
29
+ /**
30
+ * Converts a Rest Client response to a response that the LRO implementation understands
31
+ * @param response - a rest client http response
32
+ * @returns - An LRO response that the LRO implementation understands
33
+ */
34
+ function getLroResponse(response) {
35
+ if (Number.isNaN(response.status)) {
36
+ throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
37
+ }
38
+ return {
39
+ flatResponse: response,
40
+ rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
41
+ };
42
+ }
43
+ //# sourceMappingURL=pollingHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAML,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAqBzB,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,eAAwB,EACxB,UAAqE,EAAE;;IAEvE,MAAM,MAAM,GAAkC;QAC5C,aAAa,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM;QAC7C,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG;QACxC,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAC7B,sGAAsG;YACtG,2FAA2F;YAC3F,6BAA6B;YAC7B,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAC9B,sEAAsE;YACtE,4EAA4E;YAC5E,0JAA0J;YAC1J,+GAA+G;YAC/G,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;YACvF,MAAM,WAAW,GAAG,cAAc,CAAC,QAAmB,CAAC,CAAC;YACxD,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC;YACnF,OAAO,WAAW,CAAC;QACrB,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,qBAAqB,GAAG,MAAA,OAAO,CAAC,qBAAqB,mCAAI,IAAI,CAAC;IACtE,OAAO,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAA+B,QAAiB;IACrE,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjC,MAAM,IAAI,SAAS,CAAC,uDAAuD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;KAC/F;IAED,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,WAAW,kCACN,QAAQ,KACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,GACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport {\n CreateHttpPollerOptions,\n LongRunningOperation,\n LroResponse,\n OperationState,\n SimplePollerLike,\n createHttpPoller,\n} from \"@azure/core-lro\";\nimport {\n CreateJob200Response,\n CreateJob202Response,\n CreateJobDefaultResponse,\n CreateJobLogicalResponse,\n} from \"./responses\";\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<\n TResult extends CreateJobLogicalResponse | CreateJobDefaultResponse\n>(\n client: Client,\n initialResponse: CreateJob200Response | CreateJob202Response | CreateJobDefaultResponse,\n options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {}\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const poller: LongRunningOperation<TResult> = {\n requestMethod: initialResponse.request.method,\n requestPath: initialResponse.request.url,\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n const response = await client.pathUnchecked(path ?? initialResponse.request.url).get();\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n return createHttpPoller(poller, options);\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(response: TResult): LroResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=responses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport { OncoPhenotypeResultOutput } from \"./outputModels\";\n\n/** The request has succeeded. */\nexport interface GetJob200Response extends HttpResponse {\n status: \"200\";\n body: OncoPhenotypeResultOutput;\n}\n\nexport interface GetJobDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetJobDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetJobDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface CreateJob200Response extends HttpResponse {\n status: \"200\";\n body: OncoPhenotypeResultOutput;\n}\n\nexport interface CreateJob202Headers {\n /** The location for monitoring the operation state. */\n \"operation-location\": string;\n /** The Retry-After header can indicate how long the client should wait before polling the operation status. */\n \"retry-after\"?: number;\n /** Indicates whether the repeatable request was accepted or rejected. */\n \"repeatability-result\"?: \"accepted\" | \"rejected\";\n}\n\n/** The request has been accepted for processing, but processing has not yet completed. */\nexport interface CreateJob202Response extends HttpResponse {\n status: \"202\";\n headers: RawHttpHeaders & CreateJob202Headers;\n}\n\nexport interface CreateJobDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface CreateJobDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & CreateJobDefaultHeaders;\n}\n\n/** The final response for long-running createJob operation */\nexport interface CreateJobLogicalResponse extends HttpResponse {\n status: \"200\";\n body: OncoPhenotypeResultOutput;\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,126 @@
1
+ {
2
+ "name": "@azure-rest/health-insights-cancerprofiling",
3
+ "sdk-type": "client",
4
+ "author": "Microsoft Corporation",
5
+ "version": "1.0.0-alpha.20230818.1",
6
+ "description": "A generated SDK for Health Insights Cancer Profiling Rest",
7
+ "keywords": [
8
+ "node",
9
+ "azure",
10
+ "cloud",
11
+ "typescript",
12
+ "browser",
13
+ "isomorphic"
14
+ ],
15
+ "license": "MIT",
16
+ "main": "dist/index.js",
17
+ "module": "./dist-esm/src/index.js",
18
+ "types": "./types/health-insights-cancerprofiling-rest.d.ts",
19
+ "repository": "github:Azure/azure-sdk-for-js",
20
+ "bugs": {
21
+ "url": "https://github.com/Azure/azure-sdk-for-js/issues"
22
+ },
23
+ "files": [
24
+ "dist/",
25
+ "dist-esm/src/",
26
+ "types/health-indights-cancerprofiling.d.ts",
27
+ "README.md",
28
+ "LICENSE",
29
+ "review/*"
30
+ ],
31
+ "engines": {
32
+ "node": ">=14.0.0"
33
+ },
34
+ "scripts": {
35
+ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
36
+ "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
37
+ "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
38
+ "build:samples": "echo skipped.",
39
+ "build:test": "tsc -p . && dev-tool run bundle",
40
+ "build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local",
41
+ "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" \"test/**/*.ts\"",
42
+ "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
43
+ "execute:samples": "echo skipped",
44
+ "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
45
+ "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" \"test/**/*.ts\"",
46
+ "generate:client": "echo skipped",
47
+ "integration-test:browser": "dev-tool run test:browser",
48
+ "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
49
+ "integration-test": "npm run integration-test:node && npm run integration-test:browser",
50
+ "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
51
+ "lint": "eslint package.json api-extractor.json src test --ext .ts",
52
+ "pack": "npm pack 2>&1",
53
+ "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
54
+ "test:node": "npm run clean && npm run build:test && npm run unit-test:node",
55
+ "test": "npm run clean && npm run build:test && npm run unit-test",
56
+ "unit-test": "npm run unit-test:node && npm run unit-test:browser",
57
+ "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
58
+ "unit-test:browser": "dev-tool run test:browser",
59
+ "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local"
60
+ },
61
+ "sideEffects": false,
62
+ "autoPublish": false,
63
+ "dependencies": {
64
+ "@azure/core-auth": "^1.3.0",
65
+ "@azure-rest/core-client": "^1.1.3",
66
+ "@azure/core-rest-pipeline": "^1.8.0",
67
+ "@azure/logger": "^1.0.0",
68
+ "tslib": "^2.2.0",
69
+ "@azure/core-lro": "^2.5.3",
70
+ "@azure/abort-controller": "^1.0.0"
71
+ },
72
+ "devDependencies": {
73
+ "@microsoft/api-extractor": "^7.31.1",
74
+ "autorest": "latest",
75
+ "@types/node": "^14.0.0",
76
+ "dotenv": "^16.0.0",
77
+ "eslint": "^8.0.0",
78
+ "mkdirp": "^2.1.2",
79
+ "prettier": "^2.5.1",
80
+ "rimraf": "^3.0.0",
81
+ "source-map-support": "^0.5.9",
82
+ "typescript": "~5.0.0",
83
+ "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
84
+ "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
85
+ "@azure-tools/test-credential": "^1.0.0",
86
+ "@azure/identity": "^2.0.1",
87
+ "@azure-tools/test-recorder": "^3.0.0",
88
+ "mocha": "^7.1.1",
89
+ "@types/mocha": "^7.0.2",
90
+ "mocha-junit-reporter": "^1.18.0",
91
+ "cross-env": "^7.0.2",
92
+ "@types/chai": "^4.2.8",
93
+ "chai": "^4.2.0",
94
+ "karma-chrome-launcher": "^3.0.0",
95
+ "karma-coverage": "^2.0.0",
96
+ "karma-env-preprocessor": "^0.1.1",
97
+ "karma-firefox-launcher": "^1.1.0",
98
+ "karma-junit-reporter": "^2.0.1",
99
+ "karma-mocha-reporter": "^2.2.5",
100
+ "karma-mocha": "^2.0.1",
101
+ "karma-source-map-support": "~1.4.0",
102
+ "karma-sourcemap-loader": "^0.3.8",
103
+ "karma": "^6.2.0",
104
+ "nyc": "^15.0.0"
105
+ },
106
+ "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthinsights/health-insights-cancerprofiling-rest/README.md",
107
+ "//metadata": {
108
+ "constantPaths": [
109
+ {
110
+ "path": "src/cancerProfilingRest.ts",
111
+ "prefix": "userAgentInfo"
112
+ }
113
+ ]
114
+ },
115
+ "browser": {
116
+ "./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
117
+ },
118
+ "//sampleConfiguration": {
119
+ "productName": "HealthInsightsCancerprifiling",
120
+ "productSlugs": [
121
+ "azure"
122
+ ],
123
+ "disableDocsMs": true,
124
+ "apiRefLink": "https://docs.microsoft.com/javascript/api"
125
+ }
126
+ }
@@ -0,0 +1,272 @@
1
+ ## API Report File for "@azure-rest/health-insights-cancerprofiling"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { Client } from '@azure-rest/core-client';
8
+ import { ClientOptions } from '@azure-rest/core-client';
9
+ import { CreateHttpPollerOptions } from '@azure/core-lro';
10
+ import { ErrorResponse } from '@azure-rest/core-client';
11
+ import { HttpResponse } from '@azure-rest/core-client';
12
+ import { KeyCredential } from '@azure/core-auth';
13
+ import { OperationState } from '@azure/core-lro';
14
+ import { RawHttpHeaders } from '@azure/core-rest-pipeline';
15
+ import { RawHttpHeadersInput } from '@azure/core-rest-pipeline';
16
+ import { RequestParameters } from '@azure-rest/core-client';
17
+ import { SimplePollerLike } from '@azure/core-lro';
18
+ import { StreamableMethod } from '@azure-rest/core-client';
19
+
20
+ // @public (undocumented)
21
+ export type CancerProfilingRestClient = Client & {
22
+ path: Routes;
23
+ };
24
+
25
+ // @public
26
+ export interface ClinicalCodedElement {
27
+ code: string;
28
+ name?: string;
29
+ system: string;
30
+ value?: string;
31
+ }
32
+
33
+ // @public
34
+ export interface ClinicalCodedElementOutput {
35
+ code: string;
36
+ name?: string;
37
+ system: string;
38
+ value?: string;
39
+ }
40
+
41
+ // @public
42
+ export interface ClinicalNoteEvidenceOutput {
43
+ id: string;
44
+ length: number;
45
+ offset: number;
46
+ text?: string;
47
+ }
48
+
49
+ // @public
50
+ function createClient(endpoint: string, credentials: KeyCredential, options?: ClientOptions): CancerProfilingRestClient;
51
+ export default createClient;
52
+
53
+ // @public (undocumented)
54
+ export interface CreateJob {
55
+ post(options?: CreateJobParameters): StreamableMethod<CreateJob200Response | CreateJob202Response | CreateJobDefaultResponse>;
56
+ }
57
+
58
+ // @public
59
+ export interface CreateJob200Response extends HttpResponse {
60
+ // (undocumented)
61
+ body: OncoPhenotypeResultOutput;
62
+ // (undocumented)
63
+ status: "200";
64
+ }
65
+
66
+ // @public (undocumented)
67
+ export interface CreateJob202Headers {
68
+ "operation-location": string;
69
+ "repeatability-result"?: "accepted" | "rejected";
70
+ "retry-after"?: number;
71
+ }
72
+
73
+ // @public
74
+ export interface CreateJob202Response extends HttpResponse {
75
+ // (undocumented)
76
+ headers: RawHttpHeaders & CreateJob202Headers;
77
+ // (undocumented)
78
+ status: "202";
79
+ }
80
+
81
+ // @public (undocumented)
82
+ export interface CreateJobBodyParam {
83
+ // (undocumented)
84
+ body?: OncoPhenotypeData;
85
+ }
86
+
87
+ // @public (undocumented)
88
+ export interface CreateJobDefaultHeaders {
89
+ "x-ms-error-code"?: string;
90
+ }
91
+
92
+ // @public (undocumented)
93
+ export interface CreateJobDefaultResponse extends HttpResponse {
94
+ // (undocumented)
95
+ body: ErrorResponse;
96
+ // (undocumented)
97
+ headers: RawHttpHeaders & CreateJobDefaultHeaders;
98
+ // (undocumented)
99
+ status: string;
100
+ }
101
+
102
+ // @public (undocumented)
103
+ export interface CreateJobHeaderParam {
104
+ // (undocumented)
105
+ headers?: RawHttpHeadersInput & CreateJobHeaders;
106
+ }
107
+
108
+ // @public (undocumented)
109
+ export interface CreateJobHeaders {
110
+ "Repeatability-First-Sent"?: string;
111
+ "Repeatability-Request-ID"?: string;
112
+ }
113
+
114
+ // @public
115
+ export interface CreateJobLogicalResponse extends HttpResponse {
116
+ // (undocumented)
117
+ body: OncoPhenotypeResultOutput;
118
+ // (undocumented)
119
+ status: "200";
120
+ }
121
+
122
+ // @public (undocumented)
123
+ export type CreateJobParameters = CreateJobHeaderParam & CreateJobBodyParam & RequestParameters;
124
+
125
+ // @public
126
+ export interface DocumentContent {
127
+ sourceType: string;
128
+ value: string;
129
+ }
130
+
131
+ // @public
132
+ export interface ErrorModelOutput {
133
+ code: string;
134
+ details?: Array<ErrorModelOutput>;
135
+ innererror?: InnerErrorOutput;
136
+ message: string;
137
+ target?: string;
138
+ }
139
+
140
+ // @public (undocumented)
141
+ export interface GetJob {
142
+ get(options?: GetJobParameters): StreamableMethod<GetJob200Response | GetJobDefaultResponse>;
143
+ }
144
+
145
+ // @public
146
+ export interface GetJob200Response extends HttpResponse {
147
+ // (undocumented)
148
+ body: OncoPhenotypeResultOutput;
149
+ // (undocumented)
150
+ status: "200";
151
+ }
152
+
153
+ // @public (undocumented)
154
+ export interface GetJobDefaultHeaders {
155
+ "x-ms-error-code"?: string;
156
+ }
157
+
158
+ // @public (undocumented)
159
+ export interface GetJobDefaultResponse extends HttpResponse {
160
+ // (undocumented)
161
+ body: ErrorResponse;
162
+ // (undocumented)
163
+ headers: RawHttpHeaders & GetJobDefaultHeaders;
164
+ // (undocumented)
165
+ status: string;
166
+ }
167
+
168
+ // @public (undocumented)
169
+ export type GetJobParameters = RequestParameters;
170
+
171
+ // @public
172
+ export function getLongRunningPoller<TResult extends CreateJobLogicalResponse | CreateJobDefaultResponse>(client: Client, initialResponse: CreateJob200Response | CreateJob202Response | CreateJobDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
173
+
174
+ // @public
175
+ export interface InferenceEvidenceOutput {
176
+ importance?: number;
177
+ patientDataEvidence?: ClinicalNoteEvidenceOutput;
178
+ patientInfoEvidence?: ClinicalCodedElementOutput;
179
+ }
180
+
181
+ // @public
182
+ export interface InnerErrorOutput {
183
+ code?: string;
184
+ innererror?: InnerErrorOutput;
185
+ }
186
+
187
+ // @public (undocumented)
188
+ export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse): response is GetJobDefaultResponse;
189
+
190
+ // @public (undocumented)
191
+ export function isUnexpected(response: CreateJob200Response | CreateJob202Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse;
192
+
193
+ // @public
194
+ export interface OncoPhenotypeData {
195
+ configuration?: OncoPhenotypeModelConfiguration;
196
+ patients: Array<PatientRecord>;
197
+ }
198
+
199
+ // @public
200
+ export interface OncoPhenotypeInferenceOutput {
201
+ caseId?: string;
202
+ confidenceScore?: number;
203
+ description?: string;
204
+ evidence?: Array<InferenceEvidenceOutput>;
205
+ type: string;
206
+ value: string;
207
+ }
208
+
209
+ // @public
210
+ export interface OncoPhenotypeModelConfiguration {
211
+ checkForCancerCase?: boolean;
212
+ includeEvidence?: boolean;
213
+ inferenceTypes?: string[];
214
+ verbose?: boolean;
215
+ }
216
+
217
+ // @public
218
+ export interface OncoPhenotypePatientResultOutput {
219
+ id: string;
220
+ inferences: Array<OncoPhenotypeInferenceOutput>;
221
+ }
222
+
223
+ // @public
224
+ export interface OncoPhenotypeResultOutput {
225
+ readonly createdDateTime: string;
226
+ readonly errors?: Array<ErrorModelOutput>;
227
+ readonly expirationDateTime: string;
228
+ readonly jobId: string;
229
+ readonly lastUpdateDateTime: string;
230
+ readonly results?: OncoPhenotypeResultsOutput;
231
+ readonly status: string;
232
+ }
233
+
234
+ // @public
235
+ export interface OncoPhenotypeResultsOutput {
236
+ modelVersion: string;
237
+ patients: Array<OncoPhenotypePatientResultOutput>;
238
+ }
239
+
240
+ // @public
241
+ export interface PatientDocument {
242
+ clinicalType?: string;
243
+ content: DocumentContent;
244
+ createdDateTime?: Date | string;
245
+ id: string;
246
+ language?: string;
247
+ type: string;
248
+ }
249
+
250
+ // @public
251
+ export interface PatientInfo {
252
+ birthDate?: Date | string;
253
+ clinicalInfo?: Array<ClinicalCodedElement>;
254
+ sex?: string;
255
+ }
256
+
257
+ // @public
258
+ export interface PatientRecord {
259
+ data?: Array<PatientDocument>;
260
+ id: string;
261
+ info?: PatientInfo;
262
+ }
263
+
264
+ // @public (undocumented)
265
+ export interface Routes {
266
+ (path: "/oncophenotype/jobs/{jobId}", jobId: string): GetJob;
267
+ (path: "/oncophenotype/jobs"): CreateJob;
268
+ }
269
+
270
+ // (No @packageDocumentation comment for this package)
271
+
272
+ ```