@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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { getPagedAsyncIterator } from "@azure/core-paging";
|
|
4
|
+
import { createRestError } from "@azure-rest/core-client";
|
|
5
|
+
/**
|
|
6
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
7
|
+
* @param client - Client to use for sending the next page requests
|
|
8
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
9
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
10
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
11
|
+
*/
|
|
12
|
+
export function paginate(client, initialResponse, options = {}) {
|
|
13
|
+
let firstRun = true;
|
|
14
|
+
const itemName = "value";
|
|
15
|
+
const nextLinkName = "nextLink";
|
|
16
|
+
const { customGetPage } = options;
|
|
17
|
+
const pagedResult = {
|
|
18
|
+
firstPageLink: "",
|
|
19
|
+
getPage: typeof customGetPage === "function"
|
|
20
|
+
? customGetPage
|
|
21
|
+
: async (pageLink) => {
|
|
22
|
+
const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
|
|
23
|
+
firstRun = false;
|
|
24
|
+
checkPagingRequest(result);
|
|
25
|
+
const nextLink = getNextLink(result.body, nextLinkName);
|
|
26
|
+
const values = getElements(result.body, itemName);
|
|
27
|
+
return {
|
|
28
|
+
page: values,
|
|
29
|
+
nextPageLink: nextLink,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
return getPagedAsyncIterator(pagedResult);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets for the value of nextLink in the body
|
|
37
|
+
*/
|
|
38
|
+
function getNextLink(body, nextLinkName) {
|
|
39
|
+
if (!nextLinkName) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const nextLink = body[nextLinkName];
|
|
43
|
+
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
44
|
+
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
45
|
+
}
|
|
46
|
+
return nextLink;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Gets the elements of the current request in the body.
|
|
50
|
+
*/
|
|
51
|
+
function getElements(body, itemName) {
|
|
52
|
+
const value = body[itemName];
|
|
53
|
+
// value has to be an array according to the x-ms-pageable extension.
|
|
54
|
+
// The fact that this must be an array is used above to calculate the
|
|
55
|
+
// type of elements in the page in PaginateReturn
|
|
56
|
+
if (!Array.isArray(value)) {
|
|
57
|
+
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
58
|
+
}
|
|
59
|
+
return value !== null && value !== void 0 ? value : [];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Checks if a request failed
|
|
63
|
+
*/
|
|
64
|
+
function checkPagingRequest(response) {
|
|
65
|
+
const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
|
|
66
|
+
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
67
|
+
throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=paginateHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAA2C,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAU,eAAe,EAAyB,MAAM,yBAAyB,CAAC;AAyCzF;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,eAA0B,EAC1B,UAAoC,EAAE;IAItC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,MAAM,QAAQ,GAAG,OAAO,CAAC;IACzB,MAAM,YAAY,GAAG,UAAU,CAAC;IAChC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,WAAW,GAA4B;QAC3C,aAAa,EAAE,EAAE;QACjB,OAAO,EACL,OAAO,aAAa,KAAK,UAAU;YACjC,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,KAAK,EAAE,QAAgB,EAAE,EAAE;gBACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;gBACvF,QAAQ,GAAG,KAAK,CAAC;gBACjB,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;gBACxD,MAAM,MAAM,GAAG,WAAW,CAAW,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC5D,OAAO;oBACL,IAAI,EAAE,MAAM;oBACZ,YAAY,EAAE,QAAQ;iBACvB,CAAC;YACJ,CAAC;KACR,CAAC;IAEF,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,IAAa,EAAE,YAAqB;IACvD,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,QAAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,kCAAkC,CAAC,CAAC;KAClF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IAEjE,qEAAqE;IACrE,qEAAqE;IACrE,iDAAiD;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;KACH;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;KACH;AACH,CAAC","sourcesContent":["// 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"]}
|
|
@@ -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 { RequestParameters } from \"@azure-rest/core-client\";\nimport {\n WorkflowCreateOrUpdateCommand,\n UserRequestPayload,\n WorkflowRunCancelRequest,\n ApprovalResponseComment,\n ReassignCommand,\n TaskUpdateCommand,\n} from \"./models\";\n\nexport type ListWorkflowsParameters = RequestParameters;\nexport type GetWorkflowParameters = RequestParameters;\n\nexport interface CreateOrReplaceWorkflowBodyParam {\n /** Create or update workflow payload. */\n body: WorkflowCreateOrUpdateCommand;\n}\n\nexport interface CreateOrReplaceWorkflowMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type CreateOrReplaceWorkflowParameters = CreateOrReplaceWorkflowMediaTypesParam &\n CreateOrReplaceWorkflowBodyParam &\n RequestParameters;\nexport type DeleteWorkflowParameters = RequestParameters;\n\nexport interface SubmitUserRequestsBodyParam {\n /** The payload of submitting a user request. */\n body: UserRequestPayload;\n}\n\nexport interface SubmitUserRequestsMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type SubmitUserRequestsParameters = SubmitUserRequestsMediaTypesParam &\n SubmitUserRequestsBodyParam &\n RequestParameters;\n\nexport interface ListWorkflowRunsQueryParamProperties {\n /** Time window of filtering items. */\n timeWindow?: \"1d\" | \"7d\" | \"30d\" | \"90d\";\n /** The key word which used to sort the results. */\n orderby?:\n | \"status desc\"\n | \"status asc\"\n | \"requestor desc\"\n | \"requestor asc\"\n | \"startTime desc\"\n | \"startTime asc\"\n | \"createdTime desc\"\n | \"createdTime asc\";\n /** Filter workflow runs by workflow run status. */\n runStatuses?: Array<\n | \"InProgress\"\n | \"Failed\"\n | \"Completed\"\n | \"NotStarted\"\n | \"Canceling\"\n | \"CancellationFailed\"\n | \"Canceled\"\n | \"Pending\"\n | \"Approved\"\n | \"Rejected\"\n | \"sent\"\n | \"received\"\n | \"history\"\n >;\n /** Filter items by workflow id list. */\n workflowIds?: Array<string>;\n /** The maximum page size to get the items at one time. */\n maxpagesize?: number;\n}\n\nexport interface ListWorkflowRunsQueryParam {\n queryParameters?: ListWorkflowRunsQueryParamProperties;\n}\n\nexport type ListWorkflowRunsParameters = ListWorkflowRunsQueryParam & RequestParameters;\nexport type GetWorkflowRunParameters = RequestParameters;\n\nexport interface CancelWorkflowRunBodyParam {\n /** Reply of canceling a workflow run. */\n body: WorkflowRunCancelRequest;\n}\n\nexport interface CancelWorkflowRunMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type CancelWorkflowRunParameters = CancelWorkflowRunMediaTypesParam &\n CancelWorkflowRunBodyParam &\n RequestParameters;\n\nexport interface ListWorkflowTasksQueryParamProperties {\n /** To filter user's sent, received or history workflow tasks. */\n viewMode?: string;\n /** Filter items by workflow id list. */\n workflowIds?: Array<string>;\n /** Time window of filtering items. */\n timeWindow?: \"1d\" | \"7d\" | \"30d\" | \"90d\";\n /** The maximum page size to get the items at one time. */\n maxpagesize?: number;\n /** The key word which used to sort the results. */\n orderby?:\n | \"status desc\"\n | \"status asc\"\n | \"requestor desc\"\n | \"requestor asc\"\n | \"startTime desc\"\n | \"startTime asc\"\n | \"createdTime desc\"\n | \"createdTime asc\";\n /** Filter items by workflow task type. */\n taskTypes?: Array<\"Approval\" | \"SimpleTask\" | \"approval\" | \"simpleTask\">;\n /** Filter workflow tasks by status. */\n taskStatuses?: Array<\n | \"InProgress\"\n | \"Failed\"\n | \"Completed\"\n | \"NotStarted\"\n | \"Canceling\"\n | \"CancellationFailed\"\n | \"Canceled\"\n | \"Pending\"\n | \"Approved\"\n | \"Rejected\"\n | \"sent\"\n | \"received\"\n | \"history\"\n >;\n /** The key word which could used to filter workflow item with related workflow. */\n workflowNameKeyword?: string;\n}\n\nexport interface ListWorkflowTasksQueryParam {\n queryParameters?: ListWorkflowTasksQueryParamProperties;\n}\n\nexport type ListWorkflowTasksParameters = ListWorkflowTasksQueryParam & RequestParameters;\nexport type GetWorkflowTaskParameters = RequestParameters;\n\nexport interface ApproveApprovalTaskBodyParam {\n /** The request body of approving an approval request. */\n body: ApprovalResponseComment;\n}\n\nexport interface ApproveApprovalTaskMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type ApproveApprovalTaskParameters = ApproveApprovalTaskMediaTypesParam &\n ApproveApprovalTaskBodyParam &\n RequestParameters;\n\nexport interface RejectApprovalTaskBodyParam {\n /** The request body of rejecting an approval request. */\n body: ApprovalResponseComment;\n}\n\nexport interface RejectApprovalTaskMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type RejectApprovalTaskParameters = RejectApprovalTaskMediaTypesParam &\n RejectApprovalTaskBodyParam &\n RequestParameters;\n\nexport interface ReassignWorkflowTaskBodyParam {\n /** The request body of reassigning a workflow task. */\n body: ReassignCommand;\n}\n\nexport interface ReassignWorkflowTaskMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type ReassignWorkflowTaskParameters = ReassignWorkflowTaskMediaTypesParam &\n ReassignWorkflowTaskBodyParam &\n RequestParameters;\n\nexport interface UpdateTaskStatusBodyParam {\n /** Request body of updating workflow task request. */\n body: TaskUpdateCommand;\n}\n\nexport interface UpdateTaskStatusMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type UpdateTaskStatusParameters = UpdateTaskStatusMediaTypesParam &\n UpdateTaskStatusBodyParam &\n RequestParameters;\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { getClient } from "@azure-rest/core-client";
|
|
4
|
+
/**
|
|
5
|
+
* Initialize a new instance of `PurviewWorkflowClient`
|
|
6
|
+
* @param endpoint type: string, The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/
|
|
7
|
+
* @param credentials type: TokenCredential, uniquely identify client credential
|
|
8
|
+
* @param options type: ClientOptions, the parameter for all optional parameters
|
|
9
|
+
*/
|
|
10
|
+
export default function createClient(endpoint, credentials, options = {}) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}/workflow`;
|
|
13
|
+
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2022-05-01-preview";
|
|
14
|
+
options = Object.assign(Object.assign({}, options), { credentials: {
|
|
15
|
+
scopes: ["https://purview.azure.net/.default"],
|
|
16
|
+
} });
|
|
17
|
+
const userAgentInfo = `azsdk-js-purview-workflow-rest/1.0.0-beta.1`;
|
|
18
|
+
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
19
|
+
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
20
|
+
: `${userAgentInfo}`;
|
|
21
|
+
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
22
|
+
userAgentPrefix,
|
|
23
|
+
} });
|
|
24
|
+
const client = getClient(baseUrl, credentials, options);
|
|
25
|
+
return client;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=purviewWorkflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purviewWorkflow.js","sourceRoot":"","sources":["../../src/purviewWorkflow.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AAInE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,QAAgB,EAChB,WAA4B,EAC5B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,QAAQ,WAAW,CAAC;IAC1D,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,oBAAoB,CAAC;IAChE,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,oCAAoC,CAAC;SAC/C,GACF,CAAC;IAEF,MAAM,aAAa,GAAG,6CAA6C,CAAC;IACpE,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,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAA0B,CAAC;IAEjF,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 { 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"]}
|
|
@@ -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 { HttpResponse } from \"@azure-rest/core-client\";\nimport {\n WorkflowMetadataListOutput,\n ErrorResponseOutput,\n WorkflowOutput,\n UserRequestResponseOutput,\n WorkflowRunListOutput,\n WorkflowRunOutput,\n TasksListOutput,\n WorkflowTaskOutput,\n} from \"./outputModels\";\n\n/** List all workflows. */\nexport interface ListWorkflows200Response extends HttpResponse {\n status: \"200\";\n body: WorkflowMetadataListOutput;\n}\n\n/** List all workflows. */\nexport interface ListWorkflowsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Get a specific workflow. */\nexport interface GetWorkflow200Response extends HttpResponse {\n status: \"200\";\n body: WorkflowOutput;\n}\n\n/** Get a specific workflow. */\nexport interface GetWorkflowDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Create or replace a workflow. */\nexport interface CreateOrReplaceWorkflow200Response extends HttpResponse {\n status: \"200\";\n body: WorkflowOutput;\n}\n\n/** Create or replace a workflow. */\nexport interface CreateOrReplaceWorkflowDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Delete a workflow. */\nexport interface DeleteWorkflow204Response extends HttpResponse {\n status: \"204\";\n}\n\n/** Delete a workflow. */\nexport interface DeleteWorkflowDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\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. */\nexport interface SubmitUserRequests200Response extends HttpResponse {\n status: \"200\";\n body: UserRequestResponseOutput;\n}\n\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. */\nexport interface SubmitUserRequestsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** List workflow runs. */\nexport interface ListWorkflowRuns200Response extends HttpResponse {\n status: \"200\";\n body: WorkflowRunListOutput;\n}\n\n/** List workflow runs. */\nexport interface ListWorkflowRunsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Get a workflow run. */\nexport interface GetWorkflowRun200Response extends HttpResponse {\n status: \"200\";\n body: WorkflowRunOutput;\n}\n\n/** Get a workflow run. */\nexport interface GetWorkflowRunDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Cancel a workflow run. */\nexport interface CancelWorkflowRun200Response extends HttpResponse {\n status: \"200\";\n body: Record<string, unknown>;\n}\n\n/** Cancel a workflow run. */\nexport interface CancelWorkflowRunDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Get all workflow tasks. */\nexport interface ListWorkflowTasks200Response extends HttpResponse {\n status: \"200\";\n body: TasksListOutput;\n}\n\n/** Get all workflow tasks. */\nexport interface ListWorkflowTasksDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Get a workflow task. */\nexport interface GetWorkflowTask200Response extends HttpResponse {\n status: \"200\";\n body: WorkflowTaskOutput;\n}\n\n/** Get a workflow task. */\nexport interface GetWorkflowTaskDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Approve an approval task. */\nexport interface ApproveApprovalTask200Response extends HttpResponse {\n status: \"200\";\n body: Record<string, unknown>;\n}\n\n/** Approve an approval task. */\nexport interface ApproveApprovalTaskDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Reject an approval task. */\nexport interface RejectApprovalTask200Response extends HttpResponse {\n status: \"200\";\n body: Record<string, unknown>;\n}\n\n/** Reject an approval task. */\nexport interface RejectApprovalTaskDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Reassign a workflow task. */\nexport interface ReassignWorkflowTask200Response extends HttpResponse {\n status: \"200\";\n body: Record<string, unknown>;\n}\n\n/** Reassign a workflow task. */\nexport interface ReassignWorkflowTaskDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n\n/** Update the status of a workflow task request. */\nexport interface UpdateTaskStatus200Response extends HttpResponse {\n status: \"200\";\n body: Record<string, unknown>;\n}\n\n/** Update the status of a workflow task request. */\nexport interface UpdateTaskStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponseOutput;\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@azure-rest/purview-workflow",
|
|
3
|
+
"sdk-type": "client",
|
|
4
|
+
"author": "Microsoft Corporation",
|
|
5
|
+
"version": "1.0.0-beta.1",
|
|
6
|
+
"description": "A generated SDK for PurviewWorkflow.",
|
|
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/purview-workflow.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/purview-workflow.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\" \"samples-dev/**/*.ts\"",
|
|
42
|
+
"clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
43
|
+
"execute:samples": "dev-tool samples run samples-dev",
|
|
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\" \"samples-dev/**/*.ts\"",
|
|
46
|
+
"generate:client": "autorest --typescript swagger/README.md && npm run format",
|
|
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.0.0",
|
|
66
|
+
"@azure/core-rest-pipeline": "^1.8.0",
|
|
67
|
+
"@azure/logger": "^1.0.0",
|
|
68
|
+
"tslib": "^2.2.0",
|
|
69
|
+
"@azure/core-paging": "^1.2.0"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@microsoft/api-extractor": "^7.31.1",
|
|
73
|
+
"autorest": "latest",
|
|
74
|
+
"@types/node": "^14.0.0",
|
|
75
|
+
"dotenv": "^16.0.0",
|
|
76
|
+
"eslint": "^8.0.0",
|
|
77
|
+
"mkdirp": "^2.1.2",
|
|
78
|
+
"prettier": "^2.5.1",
|
|
79
|
+
"rimraf": "^3.0.0",
|
|
80
|
+
"source-map-support": "^0.5.9",
|
|
81
|
+
"typescript": "~4.8.0",
|
|
82
|
+
"@azure/dev-tool": "^1.0.0",
|
|
83
|
+
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
84
|
+
"@azure-tools/test-credential": "^1.0.0",
|
|
85
|
+
"@azure/identity": "^2.0.1",
|
|
86
|
+
"@azure-tools/test-recorder": "^3.0.0",
|
|
87
|
+
"mocha": "^7.1.1",
|
|
88
|
+
"@types/mocha": "^7.0.2",
|
|
89
|
+
"mocha-junit-reporter": "^1.18.0",
|
|
90
|
+
"cross-env": "^7.0.2",
|
|
91
|
+
"@types/chai": "^4.2.8",
|
|
92
|
+
"chai": "^4.2.0",
|
|
93
|
+
"karma-chrome-launcher": "^3.0.0",
|
|
94
|
+
"karma-coverage": "^2.0.0",
|
|
95
|
+
"karma-env-preprocessor": "^0.1.1",
|
|
96
|
+
"karma-firefox-launcher": "^1.1.0",
|
|
97
|
+
"karma-junit-reporter": "^2.0.1",
|
|
98
|
+
"karma-mocha-reporter": "^2.2.5",
|
|
99
|
+
"karma-mocha": "^2.0.1",
|
|
100
|
+
"karma-source-map-support": "~1.4.0",
|
|
101
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
102
|
+
"karma": "^6.2.0",
|
|
103
|
+
"nyc": "^15.0.0"
|
|
104
|
+
},
|
|
105
|
+
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/purview/purview-workflow-rest/README.md",
|
|
106
|
+
"//metadata": {
|
|
107
|
+
"constantPaths": [
|
|
108
|
+
{
|
|
109
|
+
"path": "src/purviewWorkflow.ts",
|
|
110
|
+
"prefix": "userAgentInfo"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"path": "swagger/README.md",
|
|
114
|
+
"prefix": "package-version"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"browser": {
|
|
119
|
+
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
|
|
120
|
+
},
|
|
121
|
+
"//sampleConfiguration": {
|
|
122
|
+
"productName": "Purview Workflow",
|
|
123
|
+
"productSlugs": [
|
|
124
|
+
"azure"
|
|
125
|
+
],
|
|
126
|
+
"disableDocsMs": true,
|
|
127
|
+
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure-rest/purview-workflow?view=azure-node-preview"
|
|
128
|
+
}
|
|
129
|
+
}
|