@azure-rest/purview-workflow 1.0.0-alpha.20250221.1 → 1.0.0-alpha.20250224.2

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 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
- ```typescript
29
+ ```ts snippet:ReadmeSampleCreateClient_Node
30
30
  import PurviewWorkflow from "@azure-rest/purview-workflow";
31
- import { UsernamePasswordCredential } from "@azure/identity";
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
- endpoint,
43
- new UsernamePasswordCredential(tenantId, clientId, username, password),
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
- ```typescript
57
- import createPurviewWorkflowClient, {
48
+ ```ts snippet:ReadmeSampleUserRequestsSubmit
49
+ import PurviewWorkflow, {
58
50
  SubmitUserRequestsParameters,
51
+ isUnexpected,
59
52
  } from "@azure-rest/purview-workflow";
60
- import { UsernamePasswordCredential } from "@azure/identity";
61
- import * as dotenv from "dotenv";
62
-
63
- dotenv.config();
64
-
65
- async function userRequestsSubmit() {
66
- const endpoint = process.env["ENDPOINT"];
67
- const tenantId = process.env["AZURE_TENANT_ID"];
68
- const clientId = process.env["AZURE_CLIENT_ID"];
69
- const username = process.env["USERNAME"];
70
- const password = process.env["PASSWORD"];
71
-
72
- const credential = new UsernamePasswordCredential(tenantId, clientId, username, password);
73
- const client = createPurviewWorkflowClient(endpoint, credential);
74
- const options: SubmitUserRequestsParameters = {
75
- body: {
76
- comment: "Thanks!",
77
- operations: [
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
- const result = await client.path("/userrequests").post(options);
93
- if (isUnexpected(result)) {
94
- throw result.body.error;
95
- }
96
- console.log(result);
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
- userRequestsSubmit().catch(console.error);
84
+ console.log(`Requestor: ${result.body.requestor}`);
100
85
  ```
101
86
 
102
87
  ### Approve workflow task
103
88
 
104
- ```typescript
105
- // This taskId represents an existing workflow task. The id can be obtained by calling GET /workflowtasks API.
106
- import createPurviewWorkflowClient, {
107
- SubmitUserRequestsParameters,
89
+ ```ts snippet:ReadmeSampleWorkflowTaskApprove
90
+ import PurviewWorkflow, {
91
+ ApproveApprovalTaskParameters,
92
+ isUnexpected,
108
93
  } from "@azure-rest/purview-workflow";
109
- import { UsernamePasswordCredential } from "@azure/identity";
110
- import * as dotenv from "dotenv";
111
-
112
- dotenv.config();
113
- async function approvalTaskApprove() {
114
- const endpoint = process.env["ENDPOINT"];
115
- const tenantId = process.env["AZURE_TENANT_ID"];
116
- const clientId = process.env["AZURE_CLIENT_ID"];
117
- const username = process.env["USERNAME"];
118
- const password = process.env["PASSWORD"];
119
- const credential = new UsernamePasswordCredential(tenantId, clientId, username, password);
120
- const client = createPurviewWorkflowClient(endpoint, credential);
121
- const taskId = "98d98e2c-23fa-4157-a3f8-ff8ce5cc095c";
122
- const options: ApproveApprovalTaskParameters = {
123
- body: { comment: "Thanks for raising this!" },
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
- approvalTaskApprove().catch(console.error);
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
- ```javascript
144
- const { setLogLevel } = require("@azure/logger");
120
+ ```ts snippet:SetLogLevel
121
+ import { setLogLevel } from "@azure/logger";
145
122
 
146
123
  setLogLevel("info");
147
124
  ```
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.50.0"
8
+ "packageVersion": "7.50.1"
9
9
  }
10
10
  ]
11
11
  }
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.20250221.1",
5
+ "version": "1.0.0-alpha.20250224.2",
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": "echo skipped"
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.18.0",
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.5.0",
73
+ "@azure/identity": "^4.7.0",
74
74
  "@types/node": "^18.0.0",
75
- "@vitest/browser": "^3.0.3",
76
- "@vitest/coverage-istanbul": "^3.0.3",
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.49.0",
80
+ "playwright": "^1.50.1",
81
81
  "typescript": "~5.7.2",
82
- "vitest": "^3.0.3"
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
  }