@azure-rest/purview-workflow 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +162 -0
- package/dist/index.js +188 -0
- package/dist/index.js.map +1 -0
- package/dist-esm/src/clientDefinitions.js +4 -0
- package/dist-esm/src/clientDefinitions.js.map +1 -0
- package/dist-esm/src/index.js +13 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/isUnexpected.js +83 -0
- package/dist-esm/src/isUnexpected.js.map +1 -0
- package/dist-esm/src/models.js +4 -0
- package/dist-esm/src/models.js.map +1 -0
- package/dist-esm/src/outputModels.js +4 -0
- package/dist-esm/src/outputModels.js.map +1 -0
- package/dist-esm/src/paginateHelper.js +70 -0
- package/dist-esm/src/paginateHelper.js.map +1 -0
- package/dist-esm/src/parameters.js +4 -0
- package/dist-esm/src/parameters.js.map +1 -0
- package/dist-esm/src/purviewWorkflow.js +27 -0
- package/dist-esm/src/purviewWorkflow.js.map +1 -0
- package/dist-esm/src/responses.js +4 -0
- package/dist-esm/src/responses.js.map +1 -0
- package/package.json +129 -0
- package/review/purview-workflow.api.md +805 -0
- package/types/purview-workflow.d.ts +920 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Microsoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Azure Purview Workflow Rest-Level client library for JavaScript
|
|
2
|
+
|
|
3
|
+
Workflows are automated, repeatable business processes that users can create within Microsoft Purview to validate and orchestrate CUD (create, update, delete) operations on their data entities. Enabling these processes allow organizations to track changes, enforce policy compliance, and ensure quality data across their data landscape.
|
|
4
|
+
|
|
5
|
+
Use the client library for Purview Workflow to:
|
|
6
|
+
|
|
7
|
+
- Manage workflows
|
|
8
|
+
- Submit user requests and monitor workflow runs
|
|
9
|
+
- View and respond to workflow tasks
|
|
10
|
+
|
|
11
|
+
**For more details about how to use workflow, please refer to the [service documentation][product_documentation]**
|
|
12
|
+
|
|
13
|
+
## Getting started
|
|
14
|
+
|
|
15
|
+
### Currently supported environments
|
|
16
|
+
|
|
17
|
+
- Node.js version 14.x.x or higher
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
- You must have an [Azure subscription][azure_subscription] and a [Purview resource][purview_resource] to use this package.
|
|
22
|
+
|
|
23
|
+
### Create and authenticate a `PurviewWorkflowClient`
|
|
24
|
+
|
|
25
|
+
Since the Workflow service uses an Azure Active Directory (AAD) bearer token for authentication and identification, an email address should be encoded into the token to allow for notification when using Workflow. It is recommended that the [Azure Identity][azure_identity] library be used with a the [UsernamePasswordCredential][username_password_credential]. Before using the [Azure Identity][azure_identity] library with Workflow, [an application][app_registration] should be registered and used for the clientId passed to the [UsernamePasswordCredential][username_password_credential].
|
|
26
|
+
Set the values of the client ID, tenant ID, username and password as environment variables:
|
|
27
|
+
AZURE_CLIENT_ID, AZURE_TENANT_ID, USERNAME, PASSWORD
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import PurviewWorkflow from "@azure-rest/purview-workflow";
|
|
31
|
+
import { UsernamePasswordCredential } from "@azure/identity";
|
|
32
|
+
import * as dotenv from "dotenv";
|
|
33
|
+
|
|
34
|
+
dotenv.config();
|
|
35
|
+
|
|
36
|
+
const endpoint = process.env["ENDPOINT"];
|
|
37
|
+
const tenantId = process.env["AZURE_TENANT_ID"];
|
|
38
|
+
const clientId = process.env["AZURE_CLIENT_ID"];
|
|
39
|
+
const username = process.env["USERNAME"];
|
|
40
|
+
const password = process.env["PASSWORD"];
|
|
41
|
+
const client = PurviewWorkflow(
|
|
42
|
+
endpoint,
|
|
43
|
+
new UsernamePasswordCredential(
|
|
44
|
+
tenantId,
|
|
45
|
+
clientId,
|
|
46
|
+
username,
|
|
47
|
+
password
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Examples
|
|
53
|
+
|
|
54
|
+
The following section provides several code snippets covering some of the most common scenarios, including:
|
|
55
|
+
|
|
56
|
+
- [Submit User Requests](#submit-user-requests)
|
|
57
|
+
- [Approve Workflow Task](#approve-workflow-task)
|
|
58
|
+
|
|
59
|
+
### Submit user requests
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import createPurviewWorkflowClient, {
|
|
63
|
+
SubmitUserRequestsParameters
|
|
64
|
+
} from "@azure-rest/purview-workflow";
|
|
65
|
+
import { UsernamePasswordCredential } from "@azure/identity";
|
|
66
|
+
import * as dotenv from "dotenv";
|
|
67
|
+
|
|
68
|
+
dotenv.config();
|
|
69
|
+
|
|
70
|
+
async function userRequestsSubmit() {
|
|
71
|
+
const endpoint = process.env["ENDPOINT"];
|
|
72
|
+
const tenantId = process.env["AZURE_TENANT_ID"];
|
|
73
|
+
const clientId = process.env["AZURE_CLIENT_ID"];
|
|
74
|
+
const username = process.env["USERNAME"];
|
|
75
|
+
const password = process.env["PASSWORD"];
|
|
76
|
+
|
|
77
|
+
const credential = new UsernamePasswordCredential(tenantId , clientId, username, password);
|
|
78
|
+
const client = createPurviewWorkflowClient(endpoint, credential);
|
|
79
|
+
const options: SubmitUserRequestsParameters = {
|
|
80
|
+
body: {
|
|
81
|
+
comment: "Thanks!",
|
|
82
|
+
operations: [
|
|
83
|
+
{
|
|
84
|
+
type: "CreateTerm",
|
|
85
|
+
payload: {
|
|
86
|
+
glossaryTerm: {
|
|
87
|
+
name: "term",
|
|
88
|
+
anchor: { glossaryGuid: "20031e20-b4df-4a66-a61d-1b0716f3fa48" },
|
|
89
|
+
nickName: "term",
|
|
90
|
+
status: "Approved"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const result = await client.path("/userrequests").post(options);
|
|
98
|
+
if (isUnexpected(result)) {
|
|
99
|
+
throw result.body.error;
|
|
100
|
+
}
|
|
101
|
+
console.log(result);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
userRequestsSubmit().catch(console.error);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Approve workflow task
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// This taskId represents an existing workflow task. The id can be obtained by calling GET /workflowtasks API.
|
|
111
|
+
import createPurviewWorkflowClient, {
|
|
112
|
+
SubmitUserRequestsParameters
|
|
113
|
+
} from "@azure-rest/purview-workflow";
|
|
114
|
+
import { UsernamePasswordCredential } from "@azure/identity";
|
|
115
|
+
import * as dotenv from "dotenv";
|
|
116
|
+
|
|
117
|
+
dotenv.config();
|
|
118
|
+
async function approvalTaskApprove() {
|
|
119
|
+
const endpoint = process.env["ENDPOINT"];
|
|
120
|
+
const tenantId = process.env["AZURE_TENANT_ID"];
|
|
121
|
+
const clientId = process.env["AZURE_CLIENT_ID"];
|
|
122
|
+
const username = process.env["USERNAME"];
|
|
123
|
+
const password = process.env["PASSWORD"];
|
|
124
|
+
const credential = new UsernamePasswordCredential(tenantId, clientId, username, password);
|
|
125
|
+
const client = createPurviewWorkflowClient(endpoint, credential);
|
|
126
|
+
const taskId = "98d98e2c-23fa-4157-a3f8-ff8ce5cc095c";
|
|
127
|
+
const options: ApproveApprovalTaskParameters = {
|
|
128
|
+
body: { comment: "Thanks for raising this!" }
|
|
129
|
+
};
|
|
130
|
+
const result = await client
|
|
131
|
+
.path("/workflowtasks/{taskId}/approve-approval", taskId)
|
|
132
|
+
.post(options);
|
|
133
|
+
if (isUnexpected(result)) {
|
|
134
|
+
throw result.body.error;
|
|
135
|
+
}
|
|
136
|
+
console.log(result);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
approvalTaskApprove().catch(console.error);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Troubleshooting
|
|
143
|
+
|
|
144
|
+
### Logging
|
|
145
|
+
|
|
146
|
+
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`:
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
const { setLogLevel } = require("@azure/logger");
|
|
150
|
+
|
|
151
|
+
setLogLevel("info");
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
|
155
|
+
|
|
156
|
+
<!-- LINKS -->
|
|
157
|
+
[product_documentation]: https://learn.microsoft.com/azure/purview/concept-workflow
|
|
158
|
+
[azure_subscription]: https://azure.microsoft.com/free/dotnet/
|
|
159
|
+
[purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal
|
|
160
|
+
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#readme
|
|
161
|
+
[app_registration]: https://learn.microsoft.com/azure/active-directory/develop/quickstart-register-app
|
|
162
|
+
[username_password_credential]: https://learn.microsoft.com/javascript/api/@azure/identity/usernamepasswordcredential?view=azure-node-latest
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var coreClient = require('@azure-rest/core-client');
|
|
6
|
+
var corePaging = require('@azure/core-paging');
|
|
7
|
+
|
|
8
|
+
// Copyright (c) Microsoft Corporation.
|
|
9
|
+
/**
|
|
10
|
+
* Initialize a new instance of `PurviewWorkflowClient`
|
|
11
|
+
* @param endpoint type: string, The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/
|
|
12
|
+
* @param credentials type: TokenCredential, uniquely identify client credential
|
|
13
|
+
* @param options type: ClientOptions, the parameter for all optional parameters
|
|
14
|
+
*/
|
|
15
|
+
function createClient(endpoint, credentials, options = {}) {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}/workflow`;
|
|
18
|
+
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2022-05-01-preview";
|
|
19
|
+
options = Object.assign(Object.assign({}, options), { credentials: {
|
|
20
|
+
scopes: ["https://purview.azure.net/.default"],
|
|
21
|
+
} });
|
|
22
|
+
const userAgentInfo = `azsdk-js-purview-workflow-rest/1.0.0-beta.1`;
|
|
23
|
+
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
24
|
+
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
25
|
+
: `${userAgentInfo}`;
|
|
26
|
+
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
27
|
+
userAgentPrefix,
|
|
28
|
+
} });
|
|
29
|
+
const client = coreClient.getClient(baseUrl, credentials, options);
|
|
30
|
+
return client;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Copyright (c) Microsoft Corporation.
|
|
34
|
+
// Licensed under the MIT license.
|
|
35
|
+
const responseMap = {
|
|
36
|
+
"GET /workflows": ["200"],
|
|
37
|
+
"GET /workflows/{workflowId}": ["200"],
|
|
38
|
+
"PUT /workflows/{workflowId}": ["200"],
|
|
39
|
+
"DELETE /workflows/{workflowId}": ["204"],
|
|
40
|
+
"POST /userrequests": ["200"],
|
|
41
|
+
"GET /workflowruns": ["200"],
|
|
42
|
+
"GET /workflowruns/{workflowRunId}": ["200"],
|
|
43
|
+
"POST /workflowruns/{workflowRunId}/cancel": ["200"],
|
|
44
|
+
"GET /workflowtasks": ["200"],
|
|
45
|
+
"GET /workflowtasks/{taskId}": ["200"],
|
|
46
|
+
"POST /workflowtasks/{taskId}/approve-approval": ["200"],
|
|
47
|
+
"POST /workflowtasks/{taskId}/reject-approval": ["200"],
|
|
48
|
+
"POST /workflowtasks/{taskId}/reassign": ["200"],
|
|
49
|
+
"POST /workflowtasks/{taskId}/change-task-status": ["200"],
|
|
50
|
+
};
|
|
51
|
+
function isUnexpected(response) {
|
|
52
|
+
const lroOriginal = response.headers["x-ms-original-url"];
|
|
53
|
+
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
54
|
+
const method = response.request.method;
|
|
55
|
+
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
56
|
+
if (!pathDetails) {
|
|
57
|
+
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
58
|
+
}
|
|
59
|
+
return !pathDetails.includes(response.status);
|
|
60
|
+
}
|
|
61
|
+
function getParametrizedPathSuccess(method, path) {
|
|
62
|
+
var _a, _b, _c, _d;
|
|
63
|
+
const pathParts = path.split("/");
|
|
64
|
+
// Traverse list to match the longest candidate
|
|
65
|
+
// matchedLen: the length of candidate path
|
|
66
|
+
// matchedValue: the matched status code array
|
|
67
|
+
let matchedLen = -1, matchedValue = [];
|
|
68
|
+
// Iterate the responseMap to find a match
|
|
69
|
+
for (const [key, value] of Object.entries(responseMap)) {
|
|
70
|
+
// Extracting the path from the map key which is in format
|
|
71
|
+
// GET /path/foo
|
|
72
|
+
if (!key.startsWith(method)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const candidatePath = getPathFromMapKey(key);
|
|
76
|
+
// Get each part of the url path
|
|
77
|
+
const candidateParts = candidatePath.split("/");
|
|
78
|
+
// track if we have found a match to return the values found.
|
|
79
|
+
let found = true;
|
|
80
|
+
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
81
|
+
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
82
|
+
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
83
|
+
// If the current part of the candidate is a "template" part
|
|
84
|
+
// Try to use the suffix of pattern to match the path
|
|
85
|
+
// {guid} ==> $
|
|
86
|
+
// {guid}:export ==> :export$
|
|
87
|
+
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
88
|
+
if (!isMatched) {
|
|
89
|
+
found = false;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
// If the candidate part is not a template and
|
|
95
|
+
// the parts don't match mark the candidate as not found
|
|
96
|
+
// to move on with the next candidate path.
|
|
97
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
98
|
+
found = false;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// We finished evaluating the current candidate parts
|
|
103
|
+
// Update the matched value if and only if we found the longer pattern
|
|
104
|
+
if (found && candidatePath.length > matchedLen) {
|
|
105
|
+
matchedLen = candidatePath.length;
|
|
106
|
+
matchedValue = value;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return matchedValue;
|
|
110
|
+
}
|
|
111
|
+
function getPathFromMapKey(mapKey) {
|
|
112
|
+
const pathStart = mapKey.indexOf("/");
|
|
113
|
+
return mapKey.slice(pathStart);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Copyright (c) Microsoft Corporation.
|
|
117
|
+
/**
|
|
118
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
119
|
+
* @param client - Client to use for sending the next page requests
|
|
120
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
121
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
122
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
123
|
+
*/
|
|
124
|
+
function paginate(client, initialResponse, options = {}) {
|
|
125
|
+
let firstRun = true;
|
|
126
|
+
const itemName = "value";
|
|
127
|
+
const nextLinkName = "nextLink";
|
|
128
|
+
const { customGetPage } = options;
|
|
129
|
+
const pagedResult = {
|
|
130
|
+
firstPageLink: "",
|
|
131
|
+
getPage: typeof customGetPage === "function"
|
|
132
|
+
? customGetPage
|
|
133
|
+
: async (pageLink) => {
|
|
134
|
+
const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
|
|
135
|
+
firstRun = false;
|
|
136
|
+
checkPagingRequest(result);
|
|
137
|
+
const nextLink = getNextLink(result.body, nextLinkName);
|
|
138
|
+
const values = getElements(result.body, itemName);
|
|
139
|
+
return {
|
|
140
|
+
page: values,
|
|
141
|
+
nextPageLink: nextLink,
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
return corePaging.getPagedAsyncIterator(pagedResult);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Gets for the value of nextLink in the body
|
|
149
|
+
*/
|
|
150
|
+
function getNextLink(body, nextLinkName) {
|
|
151
|
+
if (!nextLinkName) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
const nextLink = body[nextLinkName];
|
|
155
|
+
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
156
|
+
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
157
|
+
}
|
|
158
|
+
return nextLink;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Gets the elements of the current request in the body.
|
|
162
|
+
*/
|
|
163
|
+
function getElements(body, itemName) {
|
|
164
|
+
const value = body[itemName];
|
|
165
|
+
// value has to be an array according to the x-ms-pageable extension.
|
|
166
|
+
// The fact that this must be an array is used above to calculate the
|
|
167
|
+
// type of elements in the page in PaginateReturn
|
|
168
|
+
if (!Array.isArray(value)) {
|
|
169
|
+
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
170
|
+
}
|
|
171
|
+
return value !== null && value !== void 0 ? value : [];
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Checks if a request failed
|
|
175
|
+
*/
|
|
176
|
+
function checkPagingRequest(response) {
|
|
177
|
+
const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
|
|
178
|
+
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
179
|
+
throw coreClient.createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Copyright (c) Microsoft Corporation.
|
|
184
|
+
|
|
185
|
+
exports["default"] = createClient;
|
|
186
|
+
exports.isUnexpected = isUnexpected;
|
|
187
|
+
exports.paginate = paginate;
|
|
188
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/purviewWorkflow.ts","../src/isUnexpected.ts","../src/paginateHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { PurviewWorkflowClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `PurviewWorkflowClient`\n * @param endpoint type: string, The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/\n * @param credentials type: TokenCredential, uniquely identify client credential\n * @param options type: ClientOptions, the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): PurviewWorkflowClient {\n const baseUrl = options.baseUrl ?? `${endpoint}/workflow`;\n options.apiVersion = options.apiVersion ?? \"2022-05-01-preview\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://purview.azure.net/.default\"],\n },\n };\n\n const userAgentInfo = `azsdk-js-purview-workflow-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 };\n\n const client = getClient(baseUrl, credentials, options) as PurviewWorkflowClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n ListWorkflows200Response,\n ListWorkflowsDefaultResponse,\n GetWorkflow200Response,\n GetWorkflowDefaultResponse,\n CreateOrReplaceWorkflow200Response,\n CreateOrReplaceWorkflowDefaultResponse,\n DeleteWorkflow204Response,\n DeleteWorkflowDefaultResponse,\n SubmitUserRequests200Response,\n SubmitUserRequestsDefaultResponse,\n ListWorkflowRuns200Response,\n ListWorkflowRunsDefaultResponse,\n GetWorkflowRun200Response,\n GetWorkflowRunDefaultResponse,\n CancelWorkflowRun200Response,\n CancelWorkflowRunDefaultResponse,\n ListWorkflowTasks200Response,\n ListWorkflowTasksDefaultResponse,\n GetWorkflowTask200Response,\n GetWorkflowTaskDefaultResponse,\n ApproveApprovalTask200Response,\n ApproveApprovalTaskDefaultResponse,\n RejectApprovalTask200Response,\n RejectApprovalTaskDefaultResponse,\n ReassignWorkflowTask200Response,\n ReassignWorkflowTaskDefaultResponse,\n UpdateTaskStatus200Response,\n UpdateTaskStatusDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /workflows\": [\"200\"],\n \"GET /workflows/{workflowId}\": [\"200\"],\n \"PUT /workflows/{workflowId}\": [\"200\"],\n \"DELETE /workflows/{workflowId}\": [\"204\"],\n \"POST /userrequests\": [\"200\"],\n \"GET /workflowruns\": [\"200\"],\n \"GET /workflowruns/{workflowRunId}\": [\"200\"],\n \"POST /workflowruns/{workflowRunId}/cancel\": [\"200\"],\n \"GET /workflowtasks\": [\"200\"],\n \"GET /workflowtasks/{taskId}\": [\"200\"],\n \"POST /workflowtasks/{taskId}/approve-approval\": [\"200\"],\n \"POST /workflowtasks/{taskId}/reject-approval\": [\"200\"],\n \"POST /workflowtasks/{taskId}/reassign\": [\"200\"],\n \"POST /workflowtasks/{taskId}/change-task-status\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: ListWorkflows200Response | ListWorkflowsDefaultResponse\n): response is ListWorkflowsDefaultResponse;\nexport function isUnexpected(\n response: GetWorkflow200Response | GetWorkflowDefaultResponse\n): response is GetWorkflowDefaultResponse;\nexport function isUnexpected(\n response: CreateOrReplaceWorkflow200Response | CreateOrReplaceWorkflowDefaultResponse\n): response is CreateOrReplaceWorkflowDefaultResponse;\nexport function isUnexpected(\n response: DeleteWorkflow204Response | DeleteWorkflowDefaultResponse\n): response is DeleteWorkflowDefaultResponse;\nexport function isUnexpected(\n response: SubmitUserRequests200Response | SubmitUserRequestsDefaultResponse\n): response is SubmitUserRequestsDefaultResponse;\nexport function isUnexpected(\n response: ListWorkflowRuns200Response | ListWorkflowRunsDefaultResponse\n): response is ListWorkflowRunsDefaultResponse;\nexport function isUnexpected(\n response: GetWorkflowRun200Response | GetWorkflowRunDefaultResponse\n): response is GetWorkflowRunDefaultResponse;\nexport function isUnexpected(\n response: CancelWorkflowRun200Response | CancelWorkflowRunDefaultResponse\n): response is CancelWorkflowRunDefaultResponse;\nexport function isUnexpected(\n response: ListWorkflowTasks200Response | ListWorkflowTasksDefaultResponse\n): response is ListWorkflowTasksDefaultResponse;\nexport function isUnexpected(\n response: GetWorkflowTask200Response | GetWorkflowTaskDefaultResponse\n): response is GetWorkflowTaskDefaultResponse;\nexport function isUnexpected(\n response: ApproveApprovalTask200Response | ApproveApprovalTaskDefaultResponse\n): response is ApproveApprovalTaskDefaultResponse;\nexport function isUnexpected(\n response: RejectApprovalTask200Response | RejectApprovalTaskDefaultResponse\n): response is RejectApprovalTaskDefaultResponse;\nexport function isUnexpected(\n response: ReassignWorkflowTask200Response | ReassignWorkflowTaskDefaultResponse\n): response is ReassignWorkflowTaskDefaultResponse;\nexport function isUnexpected(\n response: UpdateTaskStatus200Response | UpdateTaskStatusDefaultResponse\n): response is UpdateTaskStatusDefaultResponse;\nexport function isUnexpected(\n response:\n | ListWorkflows200Response\n | ListWorkflowsDefaultResponse\n | GetWorkflow200Response\n | GetWorkflowDefaultResponse\n | CreateOrReplaceWorkflow200Response\n | CreateOrReplaceWorkflowDefaultResponse\n | DeleteWorkflow204Response\n | DeleteWorkflowDefaultResponse\n | SubmitUserRequests200Response\n | SubmitUserRequestsDefaultResponse\n | ListWorkflowRuns200Response\n | ListWorkflowRunsDefaultResponse\n | GetWorkflowRun200Response\n | GetWorkflowRunDefaultResponse\n | CancelWorkflowRun200Response\n | CancelWorkflowRunDefaultResponse\n | ListWorkflowTasks200Response\n | ListWorkflowTasksDefaultResponse\n | GetWorkflowTask200Response\n | GetWorkflowTaskDefaultResponse\n | ApproveApprovalTask200Response\n | ApproveApprovalTaskDefaultResponse\n | RejectApprovalTask200Response\n | RejectApprovalTaskDefaultResponse\n | ReassignWorkflowTask200Response\n | ReassignWorkflowTaskDefaultResponse\n | UpdateTaskStatus200Response\n | UpdateTaskStatusDefaultResponse\n): response is\n | ListWorkflowsDefaultResponse\n | GetWorkflowDefaultResponse\n | CreateOrReplaceWorkflowDefaultResponse\n | DeleteWorkflowDefaultResponse\n | SubmitUserRequestsDefaultResponse\n | ListWorkflowRunsDefaultResponse\n | GetWorkflowRunDefaultResponse\n | CancelWorkflowRunDefaultResponse\n | ListWorkflowTasksDefaultResponse\n | GetWorkflowTaskDefaultResponse\n | ApproveApprovalTaskDefaultResponse\n | RejectApprovalTaskDefaultResponse\n | ReassignWorkflowTaskDefaultResponse\n | UpdateTaskStatusDefaultResponse {\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 { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {}\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport PurviewWorkflow from \"./purviewWorkflow\";\n\nexport * from \"./purviewWorkflow\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\n\nexport default PurviewWorkflow;\n"],"names":["getClient","getPagedAsyncIterator","createRestError"],"mappings":";;;;;;;AAAA;AAOA;;;;;AAKG;AACW,SAAU,YAAY,CAClC,QAAgB,EAChB,WAA4B,EAC5B,OAAA,GAAyB,EAAE,EAAA;;IAE3B,MAAM,OAAO,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAG,QAAQ,CAAA,SAAA,CAAW,CAAC;IAC1D,OAAO,CAAC,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,oBAAoB,CAAC;AAChE,IAAA,OAAO,GACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,OAAO,CACV,EAAA,EAAA,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,oCAAoC,CAAC;AAC/C,SAAA,EAAA,CACF,CAAC;IAEF,MAAM,aAAa,GAAG,CAAA,2CAAA,CAA6C,CAAC;IACpE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;UACh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["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n ListWorkflowsParameters,\n GetWorkflowParameters,\n CreateOrReplaceWorkflowParameters,\n DeleteWorkflowParameters,\n SubmitUserRequestsParameters,\n ListWorkflowRunsParameters,\n GetWorkflowRunParameters,\n CancelWorkflowRunParameters,\n ListWorkflowTasksParameters,\n GetWorkflowTaskParameters,\n ApproveApprovalTaskParameters,\n RejectApprovalTaskParameters,\n ReassignWorkflowTaskParameters,\n UpdateTaskStatusParameters,\n} from \"./parameters\";\nimport {\n ListWorkflows200Response,\n ListWorkflowsDefaultResponse,\n GetWorkflow200Response,\n GetWorkflowDefaultResponse,\n CreateOrReplaceWorkflow200Response,\n CreateOrReplaceWorkflowDefaultResponse,\n DeleteWorkflow204Response,\n DeleteWorkflowDefaultResponse,\n SubmitUserRequests200Response,\n SubmitUserRequestsDefaultResponse,\n ListWorkflowRuns200Response,\n ListWorkflowRunsDefaultResponse,\n GetWorkflowRun200Response,\n GetWorkflowRunDefaultResponse,\n CancelWorkflowRun200Response,\n CancelWorkflowRunDefaultResponse,\n ListWorkflowTasks200Response,\n ListWorkflowTasksDefaultResponse,\n GetWorkflowTask200Response,\n GetWorkflowTaskDefaultResponse,\n ApproveApprovalTask200Response,\n ApproveApprovalTaskDefaultResponse,\n RejectApprovalTask200Response,\n RejectApprovalTaskDefaultResponse,\n ReassignWorkflowTask200Response,\n ReassignWorkflowTaskDefaultResponse,\n UpdateTaskStatus200Response,\n UpdateTaskStatusDefaultResponse,\n} from \"./responses\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface ListWorkflows {\n /** List all workflows. */\n get(\n options?: ListWorkflowsParameters\n ): StreamableMethod<ListWorkflows200Response | ListWorkflowsDefaultResponse>;\n}\n\nexport interface GetWorkflow {\n /** Get a specific workflow. */\n get(\n options?: GetWorkflowParameters\n ): StreamableMethod<GetWorkflow200Response | GetWorkflowDefaultResponse>;\n /** Create or replace a workflow. */\n put(\n options: CreateOrReplaceWorkflowParameters\n ): StreamableMethod<CreateOrReplaceWorkflow200Response | CreateOrReplaceWorkflowDefaultResponse>;\n /** Delete a workflow. */\n delete(\n options?: DeleteWorkflowParameters\n ): StreamableMethod<DeleteWorkflow204Response | DeleteWorkflowDefaultResponse>;\n}\n\nexport interface SubmitUserRequests {\n /** Submit a user request for requestor, a user request describes user ask to do operation(s) on Purview. If any workflow's trigger matches with an operation in request, a run of the workflow is created. */\n post(\n options: SubmitUserRequestsParameters\n ): StreamableMethod<SubmitUserRequests200Response | SubmitUserRequestsDefaultResponse>;\n}\n\nexport interface ListWorkflowRuns {\n /** List workflow runs. */\n get(\n options?: ListWorkflowRunsParameters\n ): StreamableMethod<ListWorkflowRuns200Response | ListWorkflowRunsDefaultResponse>;\n}\n\nexport interface GetWorkflowRun {\n /** Get a workflow run. */\n get(\n options?: GetWorkflowRunParameters\n ): StreamableMethod<GetWorkflowRun200Response | GetWorkflowRunDefaultResponse>;\n}\n\nexport interface CancelWorkflowRun {\n /** Cancel a workflow run. */\n post(\n options: CancelWorkflowRunParameters\n ): StreamableMethod<CancelWorkflowRun200Response | CancelWorkflowRunDefaultResponse>;\n}\n\nexport interface ListWorkflowTasks {\n /** Get all workflow tasks. */\n get(\n options?: ListWorkflowTasksParameters\n ): StreamableMethod<ListWorkflowTasks200Response | ListWorkflowTasksDefaultResponse>;\n}\n\nexport interface GetWorkflowTask {\n /** Get a workflow task. */\n get(\n options?: GetWorkflowTaskParameters\n ): StreamableMethod<GetWorkflowTask200Response | GetWorkflowTaskDefaultResponse>;\n}\n\nexport interface ApproveApprovalTask {\n /** Approve an approval task. */\n post(\n options: ApproveApprovalTaskParameters\n ): StreamableMethod<ApproveApprovalTask200Response | ApproveApprovalTaskDefaultResponse>;\n}\n\nexport interface RejectApprovalTask {\n /** Reject an approval task. */\n post(\n options: RejectApprovalTaskParameters\n ): StreamableMethod<RejectApprovalTask200Response | RejectApprovalTaskDefaultResponse>;\n}\n\nexport interface ReassignWorkflowTask {\n /** Reassign a workflow task. */\n post(\n options: ReassignWorkflowTaskParameters\n ): StreamableMethod<ReassignWorkflowTask200Response | ReassignWorkflowTaskDefaultResponse>;\n}\n\nexport interface UpdateTaskStatus {\n /** Update the status of a workflow task request. */\n post(\n options: UpdateTaskStatusParameters\n ): StreamableMethod<UpdateTaskStatus200Response | UpdateTaskStatusDefaultResponse>;\n}\n\nexport interface Routes {\n /** Resource for '/workflows' has methods for the following verbs: get */\n (path: \"/workflows\"): ListWorkflows;\n /** Resource for '/workflows/\\{workflowId\\}' has methods for the following verbs: get, put, delete */\n (path: \"/workflows/{workflowId}\", workflowId: string): GetWorkflow;\n /** Resource for '/userrequests' has methods for the following verbs: post */\n (path: \"/userrequests\"): SubmitUserRequests;\n /** Resource for '/workflowruns' has methods for the following verbs: get */\n (path: \"/workflowruns\"): ListWorkflowRuns;\n /** Resource for '/workflowruns/\\{workflowRunId\\}' has methods for the following verbs: get */\n (path: \"/workflowruns/{workflowRunId}\", workflowRunId: string): GetWorkflowRun;\n /** Resource for '/workflowruns/\\{workflowRunId\\}/cancel' has methods for the following verbs: post */\n (path: \"/workflowruns/{workflowRunId}/cancel\", workflowRunId: string): CancelWorkflowRun;\n /** Resource for '/workflowtasks' has methods for the following verbs: get */\n (path: \"/workflowtasks\"): ListWorkflowTasks;\n /** Resource for '/workflowtasks/\\{taskId\\}' has methods for the following verbs: get */\n (path: \"/workflowtasks/{taskId}\", taskId: string): GetWorkflowTask;\n /** Resource for '/workflowtasks/\\{taskId\\}/approve-approval' has methods for the following verbs: post */\n (path: \"/workflowtasks/{taskId}/approve-approval\", taskId: string): ApproveApprovalTask;\n /** Resource for '/workflowtasks/\\{taskId\\}/reject-approval' has methods for the following verbs: post */\n (path: \"/workflowtasks/{taskId}/reject-approval\", taskId: string): RejectApprovalTask;\n /** Resource for '/workflowtasks/\\{taskId\\}/reassign' has methods for the following verbs: post */\n (path: \"/workflowtasks/{taskId}/reassign\", taskId: string): ReassignWorkflowTask;\n /** Resource for '/workflowtasks/\\{taskId\\}/change-task-status' has methods for the following verbs: post */\n (path: \"/workflowtasks/{taskId}/change-task-status\", taskId: string): UpdateTaskStatus;\n}\n\nexport type PurviewWorkflowClient = Client & {\n path: Routes;\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import PurviewWorkflow from "./purviewWorkflow";
|
|
4
|
+
export * from "./purviewWorkflow";
|
|
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 "./paginateHelper";
|
|
12
|
+
export default PurviewWorkflow;
|
|
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,eAAe,MAAM,mBAAmB,CAAC;AAEhD,cAAc,mBAAmB,CAAC;AAClC,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,kBAAkB,CAAC;AAEjC,eAAe,eAAe,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport PurviewWorkflow from \"./purviewWorkflow\";\n\nexport * from \"./purviewWorkflow\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\n\nexport default PurviewWorkflow;\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
const responseMap = {
|
|
4
|
+
"GET /workflows": ["200"],
|
|
5
|
+
"GET /workflows/{workflowId}": ["200"],
|
|
6
|
+
"PUT /workflows/{workflowId}": ["200"],
|
|
7
|
+
"DELETE /workflows/{workflowId}": ["204"],
|
|
8
|
+
"POST /userrequests": ["200"],
|
|
9
|
+
"GET /workflowruns": ["200"],
|
|
10
|
+
"GET /workflowruns/{workflowRunId}": ["200"],
|
|
11
|
+
"POST /workflowruns/{workflowRunId}/cancel": ["200"],
|
|
12
|
+
"GET /workflowtasks": ["200"],
|
|
13
|
+
"GET /workflowtasks/{taskId}": ["200"],
|
|
14
|
+
"POST /workflowtasks/{taskId}/approve-approval": ["200"],
|
|
15
|
+
"POST /workflowtasks/{taskId}/reject-approval": ["200"],
|
|
16
|
+
"POST /workflowtasks/{taskId}/reassign": ["200"],
|
|
17
|
+
"POST /workflowtasks/{taskId}/change-task-status": ["200"],
|
|
18
|
+
};
|
|
19
|
+
export function isUnexpected(response) {
|
|
20
|
+
const lroOriginal = response.headers["x-ms-original-url"];
|
|
21
|
+
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
22
|
+
const method = response.request.method;
|
|
23
|
+
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
24
|
+
if (!pathDetails) {
|
|
25
|
+
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
26
|
+
}
|
|
27
|
+
return !pathDetails.includes(response.status);
|
|
28
|
+
}
|
|
29
|
+
function getParametrizedPathSuccess(method, path) {
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
|
+
const pathParts = path.split("/");
|
|
32
|
+
// Traverse list to match the longest candidate
|
|
33
|
+
// matchedLen: the length of candidate path
|
|
34
|
+
// matchedValue: the matched status code array
|
|
35
|
+
let matchedLen = -1, matchedValue = [];
|
|
36
|
+
// Iterate the responseMap to find a match
|
|
37
|
+
for (const [key, value] of Object.entries(responseMap)) {
|
|
38
|
+
// Extracting the path from the map key which is in format
|
|
39
|
+
// GET /path/foo
|
|
40
|
+
if (!key.startsWith(method)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const candidatePath = getPathFromMapKey(key);
|
|
44
|
+
// Get each part of the url path
|
|
45
|
+
const candidateParts = candidatePath.split("/");
|
|
46
|
+
// track if we have found a match to return the values found.
|
|
47
|
+
let found = true;
|
|
48
|
+
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
49
|
+
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
50
|
+
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
51
|
+
// If the current part of the candidate is a "template" part
|
|
52
|
+
// Try to use the suffix of pattern to match the path
|
|
53
|
+
// {guid} ==> $
|
|
54
|
+
// {guid}:export ==> :export$
|
|
55
|
+
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
56
|
+
if (!isMatched) {
|
|
57
|
+
found = false;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
// If the candidate part is not a template and
|
|
63
|
+
// the parts don't match mark the candidate as not found
|
|
64
|
+
// to move on with the next candidate path.
|
|
65
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
66
|
+
found = false;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// We finished evaluating the current candidate parts
|
|
71
|
+
// Update the matched value if and only if we found the longer pattern
|
|
72
|
+
if (found && candidatePath.length > matchedLen) {
|
|
73
|
+
matchedLen = candidatePath.length;
|
|
74
|
+
matchedValue = value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return matchedValue;
|
|
78
|
+
}
|
|
79
|
+
function getPathFromMapKey(mapKey) {
|
|
80
|
+
const pathStart = mapKey.indexOf("/");
|
|
81
|
+
return mapKey.slice(pathStart);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=isUnexpected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiClC,MAAM,WAAW,GAA6B;IAC5C,gBAAgB,EAAE,CAAC,KAAK,CAAC;IACzB,6BAA6B,EAAE,CAAC,KAAK,CAAC;IACtC,6BAA6B,EAAE,CAAC,KAAK,CAAC;IACtC,gCAAgC,EAAE,CAAC,KAAK,CAAC;IACzC,oBAAoB,EAAE,CAAC,KAAK,CAAC;IAC7B,mBAAmB,EAAE,CAAC,KAAK,CAAC;IAC5B,mCAAmC,EAAE,CAAC,KAAK,CAAC;IAC5C,2CAA2C,EAAE,CAAC,KAAK,CAAC;IACpD,oBAAoB,EAAE,CAAC,KAAK,CAAC;IAC7B,6BAA6B,EAAE,CAAC,KAAK,CAAC;IACtC,+CAA+C,EAAE,CAAC,KAAK,CAAC;IACxD,8CAA8C,EAAE,CAAC,KAAK,CAAC;IACvD,uCAAuC,EAAE,CAAC,KAAK,CAAC;IAChD,iDAAiD,EAAE,CAAC,KAAK,CAAC;CAC3D,CAAC;AA4CF,MAAM,UAAU,YAAY,CAC1B,QA4BmC;IAgBnC,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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right (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n ListWorkflows200Response,\n ListWorkflowsDefaultResponse,\n GetWorkflow200Response,\n GetWorkflowDefaultResponse,\n CreateOrReplaceWorkflow200Response,\n CreateOrReplaceWorkflowDefaultResponse,\n DeleteWorkflow204Response,\n DeleteWorkflowDefaultResponse,\n SubmitUserRequests200Response,\n SubmitUserRequestsDefaultResponse,\n ListWorkflowRuns200Response,\n ListWorkflowRunsDefaultResponse,\n GetWorkflowRun200Response,\n GetWorkflowRunDefaultResponse,\n CancelWorkflowRun200Response,\n CancelWorkflowRunDefaultResponse,\n ListWorkflowTasks200Response,\n ListWorkflowTasksDefaultResponse,\n GetWorkflowTask200Response,\n GetWorkflowTaskDefaultResponse,\n ApproveApprovalTask200Response,\n ApproveApprovalTaskDefaultResponse,\n RejectApprovalTask200Response,\n RejectApprovalTaskDefaultResponse,\n ReassignWorkflowTask200Response,\n ReassignWorkflowTaskDefaultResponse,\n UpdateTaskStatus200Response,\n UpdateTaskStatusDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /workflows\": [\"200\"],\n \"GET /workflows/{workflowId}\": [\"200\"],\n \"PUT /workflows/{workflowId}\": [\"200\"],\n \"DELETE /workflows/{workflowId}\": [\"204\"],\n \"POST /userrequests\": [\"200\"],\n \"GET /workflowruns\": [\"200\"],\n \"GET /workflowruns/{workflowRunId}\": [\"200\"],\n \"POST /workflowruns/{workflowRunId}/cancel\": [\"200\"],\n \"GET /workflowtasks\": [\"200\"],\n \"GET /workflowtasks/{taskId}\": [\"200\"],\n \"POST /workflowtasks/{taskId}/approve-approval\": [\"200\"],\n \"POST /workflowtasks/{taskId}/reject-approval\": [\"200\"],\n \"POST /workflowtasks/{taskId}/reassign\": [\"200\"],\n \"POST /workflowtasks/{taskId}/change-task-status\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: ListWorkflows200Response | ListWorkflowsDefaultResponse\n): response is ListWorkflowsDefaultResponse;\nexport function isUnexpected(\n response: GetWorkflow200Response | GetWorkflowDefaultResponse\n): response is GetWorkflowDefaultResponse;\nexport function isUnexpected(\n response: CreateOrReplaceWorkflow200Response | CreateOrReplaceWorkflowDefaultResponse\n): response is CreateOrReplaceWorkflowDefaultResponse;\nexport function isUnexpected(\n response: DeleteWorkflow204Response | DeleteWorkflowDefaultResponse\n): response is DeleteWorkflowDefaultResponse;\nexport function isUnexpected(\n response: SubmitUserRequests200Response | SubmitUserRequestsDefaultResponse\n): response is SubmitUserRequestsDefaultResponse;\nexport function isUnexpected(\n response: ListWorkflowRuns200Response | ListWorkflowRunsDefaultResponse\n): response is ListWorkflowRunsDefaultResponse;\nexport function isUnexpected(\n response: GetWorkflowRun200Response | GetWorkflowRunDefaultResponse\n): response is GetWorkflowRunDefaultResponse;\nexport function isUnexpected(\n response: CancelWorkflowRun200Response | CancelWorkflowRunDefaultResponse\n): response is CancelWorkflowRunDefaultResponse;\nexport function isUnexpected(\n response: ListWorkflowTasks200Response | ListWorkflowTasksDefaultResponse\n): response is ListWorkflowTasksDefaultResponse;\nexport function isUnexpected(\n response: GetWorkflowTask200Response | GetWorkflowTaskDefaultResponse\n): response is GetWorkflowTaskDefaultResponse;\nexport function isUnexpected(\n response: ApproveApprovalTask200Response | ApproveApprovalTaskDefaultResponse\n): response is ApproveApprovalTaskDefaultResponse;\nexport function isUnexpected(\n response: RejectApprovalTask200Response | RejectApprovalTaskDefaultResponse\n): response is RejectApprovalTaskDefaultResponse;\nexport function isUnexpected(\n response: ReassignWorkflowTask200Response | ReassignWorkflowTaskDefaultResponse\n): response is ReassignWorkflowTaskDefaultResponse;\nexport function isUnexpected(\n response: UpdateTaskStatus200Response | UpdateTaskStatusDefaultResponse\n): response is UpdateTaskStatusDefaultResponse;\nexport function isUnexpected(\n response:\n | ListWorkflows200Response\n | ListWorkflowsDefaultResponse\n | GetWorkflow200Response\n | GetWorkflowDefaultResponse\n | CreateOrReplaceWorkflow200Response\n | CreateOrReplaceWorkflowDefaultResponse\n | DeleteWorkflow204Response\n | DeleteWorkflowDefaultResponse\n | SubmitUserRequests200Response\n | SubmitUserRequestsDefaultResponse\n | ListWorkflowRuns200Response\n | ListWorkflowRunsDefaultResponse\n | GetWorkflowRun200Response\n | GetWorkflowRunDefaultResponse\n | CancelWorkflowRun200Response\n | CancelWorkflowRunDefaultResponse\n | ListWorkflowTasks200Response\n | ListWorkflowTasksDefaultResponse\n | GetWorkflowTask200Response\n | GetWorkflowTaskDefaultResponse\n | ApproveApprovalTask200Response\n | ApproveApprovalTaskDefaultResponse\n | RejectApprovalTask200Response\n | RejectApprovalTaskDefaultResponse\n | ReassignWorkflowTask200Response\n | ReassignWorkflowTaskDefaultResponse\n | UpdateTaskStatus200Response\n | UpdateTaskStatusDefaultResponse\n): response is\n | ListWorkflowsDefaultResponse\n | GetWorkflowDefaultResponse\n | CreateOrReplaceWorkflowDefaultResponse\n | DeleteWorkflowDefaultResponse\n | SubmitUserRequestsDefaultResponse\n | ListWorkflowRunsDefaultResponse\n | GetWorkflowRunDefaultResponse\n | CancelWorkflowRunDefaultResponse\n | ListWorkflowTasksDefaultResponse\n | GetWorkflowTaskDefaultResponse\n | ApproveApprovalTaskDefaultResponse\n | RejectApprovalTaskDefaultResponse\n | ReassignWorkflowTaskDefaultResponse\n | UpdateTaskStatusDefaultResponse {\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 @@
|
|
|
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/** Describes under what condition a workflow will run. */\nexport interface Trigger {\n type:\n | \"when_term_creation_is_requested\"\n | \"when_term_deletion_is_requested\"\n | \"when_term_update_is_requested\"\n | \"when_terms_import_is_requested\"\n | \"when_data_access_grant_is_requested\"\n | \"when_asset_update_is_requested\";\n /** Glossary term hierarchy path. */\n underGlossaryHierarchy?: string;\n /** The collection name. */\n underCollection?: string;\n /** The glossary guid. */\n underGlossary?: string;\n}\n\n/** Create or update workflow payload. */\nexport interface WorkflowCreateOrUpdateCommand {\n /** It describes under what condition a workflow will run. */\n triggers: Array<Trigger>;\n /** The workflow name. */\n name: string;\n /** Whether the workflow enabled or not. */\n isEnabled: boolean;\n /** Description of a workflow. */\n description: string;\n /** The action DAG(Directed Acyclic Graph), it defines actual flow. */\n actionDag?: Record<string, unknown>;\n}\n\nexport interface UserRequestPayload {\n /** The list of operations user want to submit, each operation matches one Purview API call and will do the operation directly. */\n operations: Array<Operation>;\n /** The comment when submit a user request. */\n comment?: string;\n}\n\n/** The operation user wants to perform. */\nexport interface Operation {\n /** The operation type. */\n type:\n | \"CreateTerm\"\n | \"UpdateTerm\"\n | \"DeleteTerm\"\n | \"ImportTerms\"\n | \"UpdateAsset\"\n | \"GrantDataAccess\";\n /** The payload of each operation which user want to submit. */\n payload: Record<string, unknown>;\n}\n\nexport interface WorkflowRunCancelRequest {\n /** The comment of canceling a workflow run. */\n comment?: string;\n}\n\nexport interface ApprovalResponseComment {\n /** The comment of approving or rejecting an approval request. */\n comment?: string;\n}\n\n/** The request payload of reassigning a workflow task. */\nexport interface ReassignCommand {\n /** The request body of reassigning a workflow task. */\n reassignments?: Array<ReassignCommandReassignmentsItem>;\n}\n\nexport interface ReassignCommandReassignmentsItem {\n /**\n * Reassign a workflow task from a user or a group.\n *\n * Value may contain a UUID\n */\n reassignFrom: string;\n /**\n * Reassign a workflow task to a user or a group.\n *\n * Value may contain a UUID\n */\n reassignTo: string;\n}\n\nexport interface TaskUpdateCommand {\n /** The new status will be used to update the task. */\n newStatus: \"NotStarted\" | \"InProgress\" | \"Completed\" | \"Canceled\";\n /** The comment when update a task. */\n comment?: string;\n}\n"]}
|
|
@@ -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 workflow list. */\nexport interface WorkflowMetadataListOutput {\n /** The value of workflow list. */\n value: Array<WorkflowMetadataOutput>;\n /** The URL to get the next set of results. */\n nextLink?: string;\n}\n\n/** The workflow metadata, action DAGs are not included. */\nexport interface WorkflowMetadataOutput {\n /**\n * The id of workflow.\n *\n * Value may contain a UUID\n */\n id: string;\n /** It describes under what condition a workflow will run. */\n triggers: Array<TriggerOutput>;\n /** The created time of workflow. */\n createdTime?: string;\n /** The person who created the workflow. */\n createdBy?: string;\n /** The last update time. */\n lastUpdateTime?: string;\n /** The person who updated the workflow. */\n updatedBy?: string;\n /** The name of a workflow. */\n name: string;\n /** Whether the workflow is enabled or not. */\n isEnabled: boolean;\n /** Description of a workflow. */\n description: string;\n}\n\n/** Describes under what condition a workflow will run. */\nexport interface TriggerOutput {\n type:\n | \"when_term_creation_is_requested\"\n | \"when_term_deletion_is_requested\"\n | \"when_term_update_is_requested\"\n | \"when_terms_import_is_requested\"\n | \"when_data_access_grant_is_requested\"\n | \"when_asset_update_is_requested\";\n /** Glossary term hierarchy path. */\n underGlossaryHierarchy?: string;\n /** The collection name. */\n underCollection?: string;\n /** The glossary guid. */\n underGlossary?: string;\n}\n\n/** Default error response model */\nexport interface ErrorResponseOutput {\n /** Default error model */\n error: ErrorModelOutput;\n}\n\n/** Default error model */\nexport interface ErrorModelOutput {\n /** Gets or sets the code. */\n code: string;\n /** Gets or sets the details. */\n details?: Array<ErrorModelOutput>;\n /** Gets or sets the messages. */\n message: string;\n /** Gets or sets the target. */\n target?: string;\n}\n\n/** The workflow properties. It includes the triggers, actual flow and other properties of a workflow. */\nexport interface WorkflowOutput extends WorkflowMetadataOutput {\n /** The action DAG(Directed Acyclic Graph), it defines steps to be executed in a workflow run and their order. */\n actionDag: Record<string, unknown>;\n}\n\n/** Describes user ask to do operation(s) on Purview. */\nexport interface UserRequestResponseOutput {\n /**\n * The user request id.\n *\n * Value may contain a UUID\n */\n requestId: string;\n /**\n * The person who submitted the user request.\n *\n * Value may contain a UUID\n */\n requestor: string;\n /** The list of operations user want to submit, each operation matches one Purview API call and will do the operation directly. */\n operations: Array<UserRequestResponseOperationsItemOutput>;\n /** The comment when submit a user request. */\n comment?: string;\n /** The status. */\n status:\n | \"NotStarted\"\n | \"InProgress\"\n | \"Failed\"\n | \"Completed\"\n | \"Canceling\"\n | \"CancellationFailed\"\n | \"Canceled\";\n}\n\n/** The operation user wants to perform. */\nexport interface UserRequestResponseOperationsItemOutput {\n /** The operation type. */\n type:\n | \"CreateTerm\"\n | \"UpdateTerm\"\n | \"DeleteTerm\"\n | \"ImportTerms\"\n | \"UpdateAsset\"\n | \"GrantDataAccess\";\n /** The payload of each operation which user want to submit. */\n payload: Record<string, unknown>;\n workflowRunIds?: Array<string>;\n}\n\nexport interface WorkflowRunListOutput {\n /** The value of workflow run list. */\n value: Array<WorkflowRunMetadataOutput>;\n /** The URL to get the next set of results. */\n nextLink?: string;\n}\n\n/** The execution of a workflow. It includes status of the entire run and other properties of a run. */\nexport interface WorkflowRunMetadataOutput {\n /**\n * The workflow run id.\n *\n * Value may contain a UUID\n */\n id: string;\n /**\n * The workflow id.\n *\n * Value may contain a UUID\n */\n workflowId: string;\n /** Workflow run start time. */\n startTime: string;\n /**\n * The person who submitted the user request.\n *\n * Value may contain a UUID\n */\n requestor: string;\n /**\n * The user request id.\n *\n * Value may contain a UUID\n */\n userRequestId?: string;\n /** The input of a workflow run. Align with operation in user request. */\n runPayload: WorkflowRunPayloadOutput;\n /** The status. */\n status:\n | \"NotStarted\"\n | \"InProgress\"\n | \"Failed\"\n | \"Completed\"\n | \"Canceling\"\n | \"CancellationFailed\"\n | \"Canceled\";\n /** The time of workflow run completed. */\n endTime?: string;\n /** The time of workflow run be canceled. */\n cancelTime?: string;\n /** The comment when cancel a workflow run. */\n cancelComment?: string;\n}\n\n/** The input of a workflow run. Align with operation in user request. */\nexport interface WorkflowRunPayloadOutput {\n /** The workflow run payload type. */\n type:\n | \"CreateTerm\"\n | \"UpdateTerm\"\n | \"DeleteTerm\"\n | \"ImportTerms\"\n | \"UpdateAsset\"\n | \"GrantDataAccess\";\n /** The target value which need involve workflow to update. */\n targetValue: string;\n}\n\n/** The execution of a workflow. It includes workflow action DAG at run time (action DAG snapshot), run payload, status of the entire run and other properties of a run. */\nexport interface WorkflowRunOutput {\n /**\n * The workflow run id.\n *\n * Value may contain a UUID\n */\n id?: string;\n /**\n * The workflow id.\n *\n * Value may contain a UUID\n */\n workflowId?: string;\n /** Workflow run start time. */\n startTime?: string;\n /**\n * The person who submitted the user request.\n *\n * Value may contain a UUID\n */\n requestor?: string;\n /**\n * The user request id.\n *\n * Value may contain a UUID\n */\n userRequestId?: string;\n /** The input of a workflow run. Align with operation in user request. */\n runPayload?: WorkflowRunRunPayloadOutput;\n /** The status. */\n status?:\n | \"NotStarted\"\n | \"InProgress\"\n | \"Failed\"\n | \"Completed\"\n | \"Canceling\"\n | \"CancellationFailed\"\n | \"Canceled\";\n /** The time of workflow run completed. */\n endTime?: string;\n /** The time of workflow run be canceled. */\n cancelTime?: string;\n /** The comment when cancel a workflow run. */\n cancelComment?: string;\n /** The action DAG(Directed Acyclic Graph), it defines actual flow. */\n actionDag: Record<string, unknown>;\n /** It refers to the \"detail\" property of a workflow run object, which contains run context and runtime information of actions. */\n detail: WorkflowRunDetailOutput;\n}\n\n/** The input of a workflow run. Align with operation in user request. */\nexport interface WorkflowRunRunPayloadOutput {\n /** The workflow run payload type. */\n type:\n | \"CreateTerm\"\n | \"UpdateTerm\"\n | \"DeleteTerm\"\n | \"ImportTerms\"\n | \"UpdateAsset\"\n | \"GrantDataAccess\";\n /** The target value which need involve workflow to update. */\n targetValue: string;\n /** The payload of each operation which user want to submit. */\n payload: Record<string, unknown>;\n}\n\n/** It refers to the \"detail\" property of a workflow run object, which contains run context and runtime information of actions. */\nexport interface WorkflowRunDetailOutput {\n /** Built-in variables starts with @runInput. Its properties are determined by trigger type at workflow run time. */\n runInput: Record<string, unknown>;\n /** Any object */\n actions: Record<string, unknown>;\n}\n\nexport interface TasksListOutput {\n /** The value of workflow tasks list. */\n value: Array<WorkflowTaskOutput>;\n /** The URL to get the next set of results. */\n nextLink?: string;\n}\n\n/** An actionable item assigned to assignees. It is created when approval or task action starts to execute. Approval is one kind of task. */\nexport interface WorkflowTaskOutputParent {\n /**\n * The workflow task id.\n *\n * Value may contain a UUID\n */\n id: string;\n /** The workflow task title. */\n title?: string;\n /**\n * The workflow run id.\n *\n * Value may contain a UUID\n */\n workflowRunId: string;\n /**\n * The workflow id.\n *\n * Value may contain a UUID\n */\n workflowId: string;\n /**\n * The person who submitted the user request.\n *\n * Value may contain a UUID\n */\n requestor: string;\n /** The created time. */\n createdTime: string;\n /** The last update time. */\n lastUpdateTime: string;\n /** Info and material that helps assignees to take action. */\n payload: TaskPayloadOutput;\n /** Info of task reminder. */\n reminderInfo?: WorkflowTaskReminderInfoOutput;\n /** Info of task expiry. */\n expiryInfo?: WorkflowTaskExpiryInfoOutput;\n type: \"WorkflowTask\" | \"Approval\" | \"SimpleTask\";\n}\n\n/** Info and material that helps assignees to take action. */\nexport interface TaskPayloadOutput {\n /** The task payload type. */\n type:\n | \"CreateTerm\"\n | \"UpdateTerm\"\n | \"DeleteTerm\"\n | \"ImportTerms\"\n | \"UpdateAsset\"\n | \"GrantDataAccess\";\n /** The target value of entity which user want to involve workflow to update. */\n targetValue: string;\n /** The payload of the task. */\n payload?: Record<string, unknown>;\n}\n\n/** Info of task reminder. */\nexport interface WorkflowTaskReminderInfoOutput {\n /** The last update time. */\n lastRemindTime?: string;\n /** The next remind time. */\n nextRemindTime: string;\n /** The reminder settings. */\n reminderSettings: Record<string, unknown>;\n}\n\n/** Info of task expiry. */\nexport interface WorkflowTaskExpiryInfoOutput {\n /** The last expiry notification time. */\n lastExpiryNotificationTime?: string;\n /** The next expiry notification time. */\n nextExpiryNotificationTime: string;\n /** The expiry time. */\n expiryTime: string;\n expirySettings: WorkflowTaskExpiryInfoExpirySettingsOutput;\n}\n\nexport interface WorkflowTaskExpiryInfoExpirySettingsOutput {\n /** The time of expiry. */\n expireAfter: Record<string, unknown>;\n notifyOnExpiration?: Array<string>;\n}\n\n/** The workflow approval task properties. */\nexport interface ApprovalOutput extends WorkflowTaskOutputParent {\n /** The approval task details */\n approvalDetail?: ApprovalDetailOutput;\n type: \"Approval\";\n}\n\n/** The approval task details */\nexport interface ApprovalDetailOutput {\n /** The approval type of an approval task. */\n approvalType: \"PendingOnAny\" | \"PendingOnAll\";\n /** The status of an approval task. */\n status: \"Pending\" | \"Approved\" | \"Rejected\" | \"Canceled\";\n /** The list of approvers with reply. */\n approvers: Record<string, ApproverResponseOutput>;\n}\n\n/** The response of approvers for a workflow task. */\nexport interface ApproverResponseOutput {\n /** The response for an approval task. */\n reply: \"Approved\" | \"Rejected\" | \"Pending\";\n /** The comment of approving or rejecting an approval request. */\n comment?: string;\n /** The reply time of approver to a workflow task. */\n responseTime?: string;\n}\n\n/** The workflow simple task properties. */\nexport interface SimpleTaskOutput extends WorkflowTaskOutputParent {\n /** Workflow simple task details. */\n taskDetail?: SimpleTaskDetailOutput;\n type: \"SimpleTask\";\n}\n\n/** Workflow simple task details. */\nexport interface SimpleTaskDetailOutput {\n /** The simple task body. */\n taskBody: string;\n /** The users or groups were assigned the simple task. */\n assignedTo: Array<string>;\n /** Simple task status. */\n status: \"NotStarted\" | \"InProgress\" | \"Completed\" | \"Canceled\";\n changeHistory: Array<Record<string, unknown>>;\n}\n\n/** An actionable item assigned to assignees. It is created when approval or task action starts to execute. Approval is one kind of task. */\nexport type WorkflowTaskOutput = ApprovalOutput | SimpleTaskOutput;\n"]}
|