@azure-rest/purview-workflow 1.0.0-alpha.20250221.1 → 1.0.0-alpha.20250225.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 +57 -80
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -26,21 +26,13 @@ Since the Workflow service uses an Azure Active Directory (AAD) bearer token for
|
|
|
26
26
|
Set the values of the client ID, tenant ID, username and password as environment variables:
|
|
27
27
|
AZURE_CLIENT_ID, AZURE_TENANT_ID, USERNAME, PASSWORD
|
|
28
28
|
|
|
29
|
-
```
|
|
29
|
+
```ts snippet:ReadmeSampleCreateClient_Node
|
|
30
30
|
import PurviewWorkflow from "@azure-rest/purview-workflow";
|
|
31
|
-
import {
|
|
32
|
-
import * as dotenv from "dotenv";
|
|
31
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
33
32
|
|
|
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
33
|
const client = PurviewWorkflow(
|
|
42
|
-
|
|
43
|
-
new
|
|
34
|
+
"https://<my-account-name>.purview.azure.com",
|
|
35
|
+
new DefaultAzureCredential(),
|
|
44
36
|
);
|
|
45
37
|
```
|
|
46
38
|
|
|
@@ -53,85 +45,70 @@ The following section provides several code snippets covering some of the most c
|
|
|
53
45
|
|
|
54
46
|
### Submit user requests
|
|
55
47
|
|
|
56
|
-
```
|
|
57
|
-
import
|
|
48
|
+
```ts snippet:ReadmeSampleUserRequestsSubmit
|
|
49
|
+
import PurviewWorkflow, {
|
|
58
50
|
SubmitUserRequestsParameters,
|
|
51
|
+
isUnexpected,
|
|
59
52
|
} from "@azure-rest/purview-workflow";
|
|
60
|
-
import {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
type: "CreateTerm",
|
|
80
|
-
payload: {
|
|
81
|
-
glossaryTerm: {
|
|
82
|
-
name: "term",
|
|
83
|
-
anchor: { glossaryGuid: "20031e20-b4df-4a66-a61d-1b0716f3fa48" },
|
|
84
|
-
nickName: "term",
|
|
85
|
-
status: "Approved",
|
|
86
|
-
},
|
|
53
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
54
|
+
|
|
55
|
+
const client = PurviewWorkflow(
|
|
56
|
+
"https://<my-account-name>.purview.azure.com",
|
|
57
|
+
new DefaultAzureCredential(),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const options: SubmitUserRequestsParameters = {
|
|
61
|
+
body: {
|
|
62
|
+
comment: "Thanks!",
|
|
63
|
+
operations: [
|
|
64
|
+
{
|
|
65
|
+
type: "CreateTerm",
|
|
66
|
+
payload: {
|
|
67
|
+
glossaryTerm: {
|
|
68
|
+
name: "term",
|
|
69
|
+
anchor: { glossaryGuid: "20031e20-b4df-4a66-a61d-1b0716f3fa48" },
|
|
70
|
+
nickName: "term",
|
|
71
|
+
status: "Approved",
|
|
87
72
|
},
|
|
88
73
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const result = await client.path("/userrequests").post(options);
|
|
79
|
+
|
|
80
|
+
if (isUnexpected(result)) {
|
|
81
|
+
throw result.body.error;
|
|
97
82
|
}
|
|
98
83
|
|
|
99
|
-
|
|
84
|
+
console.log(`Requestor: ${result.body.requestor}`);
|
|
100
85
|
```
|
|
101
86
|
|
|
102
87
|
### Approve workflow task
|
|
103
88
|
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
89
|
+
```ts snippet:ReadmeSampleWorkflowTaskApprove
|
|
90
|
+
import PurviewWorkflow, {
|
|
91
|
+
ApproveApprovalTaskParameters,
|
|
92
|
+
isUnexpected,
|
|
108
93
|
} from "@azure-rest/purview-workflow";
|
|
109
|
-
import {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
};
|
|
125
|
-
const result = await client
|
|
126
|
-
.path("/workflowtasks/{taskId}/approve-approval", taskId)
|
|
127
|
-
.post(options);
|
|
128
|
-
if (isUnexpected(result)) {
|
|
129
|
-
throw result.body.error;
|
|
130
|
-
}
|
|
131
|
-
console.log(result);
|
|
94
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
95
|
+
|
|
96
|
+
const client = PurviewWorkflow(
|
|
97
|
+
"https://<my-account-name>.purview.azure.com",
|
|
98
|
+
new DefaultAzureCredential(),
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const taskId = "98d98e2c-23fa-4157-a3f8-ff8ce5cc095c";
|
|
102
|
+
const options: ApproveApprovalTaskParameters = {
|
|
103
|
+
body: { comment: "Thanks for raising this!" },
|
|
104
|
+
};
|
|
105
|
+
const result = await client.path("/workflowtasks/{taskId}/approve-approval", taskId).post(options);
|
|
106
|
+
|
|
107
|
+
if (isUnexpected(result)) {
|
|
108
|
+
throw result.body.error;
|
|
132
109
|
}
|
|
133
110
|
|
|
134
|
-
|
|
111
|
+
console.log(`Task approved with Task ID: ${taskId}`);
|
|
135
112
|
```
|
|
136
113
|
|
|
137
114
|
## Troubleshooting
|
|
@@ -140,8 +117,8 @@ approvalTaskApprove().catch(console.error);
|
|
|
140
117
|
|
|
141
118
|
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`:
|
|
142
119
|
|
|
143
|
-
```
|
|
144
|
-
|
|
120
|
+
```ts snippet:SetLogLevel
|
|
121
|
+
import { setLogLevel } from "@azure/logger";
|
|
145
122
|
|
|
146
123
|
setLogLevel("info");
|
|
147
124
|
```
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure-rest/purview-workflow",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "1.0.0-alpha.
|
|
5
|
+
"version": "1.0.0-alpha.20250225.1",
|
|
6
6
|
"description": "A generated SDK for PurviewWorkflow.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
54
54
|
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
|
|
55
55
|
"unit-test:node": "dev-tool run test:vitest",
|
|
56
|
-
"update-snippets": "
|
|
56
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
57
57
|
},
|
|
58
58
|
"sideEffects": false,
|
|
59
59
|
"autoPublish": false,
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@azure-rest/core-client": "^2.3.1",
|
|
62
62
|
"@azure/core-auth": "^1.9.0",
|
|
63
|
-
"@azure/core-rest-pipeline": "^1.
|
|
63
|
+
"@azure/core-rest-pipeline": "^1.19.0",
|
|
64
64
|
"@azure/logger": "^1.1.4",
|
|
65
65
|
"tslib": "^2.8.1"
|
|
66
66
|
},
|
|
@@ -70,16 +70,16 @@
|
|
|
70
70
|
"@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
|
|
71
71
|
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
72
72
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
73
|
-
"@azure/identity": "^4.
|
|
73
|
+
"@azure/identity": "^4.7.0",
|
|
74
74
|
"@types/node": "^18.0.0",
|
|
75
|
-
"@vitest/browser": "^3.0.
|
|
76
|
-
"@vitest/coverage-istanbul": "^3.0.
|
|
75
|
+
"@vitest/browser": "^3.0.6",
|
|
76
|
+
"@vitest/coverage-istanbul": "^3.0.6",
|
|
77
77
|
"autorest": "latest",
|
|
78
78
|
"dotenv": "^16.0.0",
|
|
79
79
|
"eslint": "^9.9.0",
|
|
80
|
-
"playwright": "^1.
|
|
80
|
+
"playwright": "^1.50.1",
|
|
81
81
|
"typescript": "~5.7.2",
|
|
82
|
-
"vitest": "^3.0.
|
|
82
|
+
"vitest": "^3.0.6"
|
|
83
83
|
},
|
|
84
84
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/purview/purview-workflow-rest/README.md",
|
|
85
85
|
"//metadata": {
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"type": "module",
|
|
106
106
|
"tshy": {
|
|
107
|
+
"project": "./tsconfig.src.json",
|
|
107
108
|
"exports": {
|
|
108
109
|
"./package.json": "./package.json",
|
|
109
110
|
".": "./src/index.ts"
|
|
@@ -116,8 +117,7 @@
|
|
|
116
117
|
"browser",
|
|
117
118
|
"react-native"
|
|
118
119
|
],
|
|
119
|
-
"selfLink": false
|
|
120
|
-
"project": "./tsconfig.src.json"
|
|
120
|
+
"selfLink": false
|
|
121
121
|
},
|
|
122
122
|
"exports": {
|
|
123
123
|
"./package.json": "./package.json",
|
|
@@ -139,5 +139,6 @@
|
|
|
139
139
|
"default": "./dist/commonjs/index.js"
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
}
|
|
142
|
+
},
|
|
143
|
+
"react-native": "./dist/react-native/index.js"
|
|
143
144
|
}
|