@azure-rest/purview-workflow 1.0.0-beta.1 → 1.0.0-beta.3

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.
Files changed (187) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +4 -4
  3. package/README.md +65 -92
  4. package/dist/browser/clientDefinitions.d.ts +85 -0
  5. package/dist/browser/clientDefinitions.d.ts.map +1 -0
  6. package/dist/browser/clientDefinitions.js +4 -0
  7. package/dist/browser/clientDefinitions.js.map +1 -0
  8. package/dist/browser/index.d.ts +11 -0
  9. package/dist/browser/index.d.ts.map +1 -0
  10. package/dist/browser/index.js +13 -0
  11. package/dist/browser/index.js.map +1 -0
  12. package/dist/browser/isUnexpected.d.ts +16 -0
  13. package/dist/browser/isUnexpected.d.ts.map +1 -0
  14. package/{dist-esm/src → dist/browser}/isUnexpected.js +5 -6
  15. package/dist/browser/isUnexpected.js.map +1 -0
  16. package/dist/browser/logger.d.ts +2 -0
  17. package/dist/browser/logger.d.ts.map +1 -0
  18. package/dist/browser/logger.js +5 -0
  19. package/dist/browser/logger.js.map +1 -0
  20. package/dist/browser/models.d.ts +70 -0
  21. package/dist/browser/models.d.ts.map +1 -0
  22. package/dist/browser/models.js +4 -0
  23. package/{dist-esm/src → dist/browser}/models.js.map +1 -1
  24. package/dist/browser/outputModels.d.ts +325 -0
  25. package/dist/browser/outputModels.d.ts.map +1 -0
  26. package/dist/browser/outputModels.js +4 -0
  27. package/{dist-esm/src → dist/browser}/outputModels.js.map +1 -1
  28. package/dist/browser/package.json +3 -0
  29. package/dist/browser/paginateHelper.d.ts +68 -0
  30. package/dist/browser/paginateHelper.d.ts.map +1 -0
  31. package/{dist-esm/src → dist/browser}/paginateHelper.js +70 -3
  32. package/dist/browser/paginateHelper.js.map +1 -0
  33. package/dist/browser/parameters.d.ts +109 -0
  34. package/dist/browser/parameters.d.ts.map +1 -0
  35. package/dist/browser/parameters.js +4 -0
  36. package/dist/browser/parameters.js.map +1 -0
  37. package/dist/browser/purviewWorkflow.d.ts +16 -0
  38. package/dist/browser/purviewWorkflow.d.ts.map +1 -0
  39. package/dist/browser/purviewWorkflow.js +45 -0
  40. package/dist/browser/purviewWorkflow.js.map +1 -0
  41. package/dist/browser/responses.d.ts +137 -0
  42. package/dist/browser/responses.d.ts.map +1 -0
  43. package/dist/browser/responses.js +4 -0
  44. package/dist/browser/responses.js.map +1 -0
  45. package/dist/commonjs/clientDefinitions.d.ts +85 -0
  46. package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
  47. package/dist/commonjs/clientDefinitions.js +5 -0
  48. package/dist/commonjs/clientDefinitions.js.map +1 -0
  49. package/dist/commonjs/index.d.ts +11 -0
  50. package/dist/commonjs/index.d.ts.map +1 -0
  51. package/dist/commonjs/index.js +16 -0
  52. package/dist/commonjs/index.js.map +1 -0
  53. package/dist/commonjs/isUnexpected.d.ts +16 -0
  54. package/dist/commonjs/isUnexpected.d.ts.map +1 -0
  55. package/dist/commonjs/isUnexpected.js +85 -0
  56. package/dist/commonjs/isUnexpected.js.map +1 -0
  57. package/dist/commonjs/logger.d.ts +2 -0
  58. package/dist/commonjs/logger.d.ts.map +1 -0
  59. package/dist/commonjs/logger.js +8 -0
  60. package/dist/commonjs/logger.js.map +1 -0
  61. package/dist/commonjs/models.d.ts +70 -0
  62. package/dist/commonjs/models.d.ts.map +1 -0
  63. package/dist/commonjs/models.js +5 -0
  64. package/dist/commonjs/models.js.map +1 -0
  65. package/dist/commonjs/outputModels.d.ts +325 -0
  66. package/dist/commonjs/outputModels.d.ts.map +1 -0
  67. package/dist/commonjs/outputModels.js +5 -0
  68. package/dist/commonjs/outputModels.js.map +1 -0
  69. package/dist/commonjs/package.json +3 -0
  70. package/dist/commonjs/paginateHelper.d.ts +68 -0
  71. package/dist/commonjs/paginateHelper.d.ts.map +1 -0
  72. package/dist/commonjs/paginateHelper.js +140 -0
  73. package/dist/commonjs/paginateHelper.js.map +1 -0
  74. package/dist/commonjs/parameters.d.ts +109 -0
  75. package/dist/commonjs/parameters.d.ts.map +1 -0
  76. package/dist/commonjs/parameters.js +5 -0
  77. package/dist/commonjs/parameters.js.map +1 -0
  78. package/dist/commonjs/purviewWorkflow.d.ts +16 -0
  79. package/dist/commonjs/purviewWorkflow.d.ts.map +1 -0
  80. package/dist/commonjs/purviewWorkflow.js +48 -0
  81. package/dist/commonjs/purviewWorkflow.js.map +1 -0
  82. package/dist/commonjs/responses.d.ts +137 -0
  83. package/dist/commonjs/responses.d.ts.map +1 -0
  84. package/dist/commonjs/responses.js +5 -0
  85. package/dist/commonjs/responses.js.map +1 -0
  86. package/dist/commonjs/tsdoc-metadata.json +11 -0
  87. package/dist/esm/clientDefinitions.d.ts +85 -0
  88. package/dist/esm/clientDefinitions.d.ts.map +1 -0
  89. package/dist/esm/clientDefinitions.js +4 -0
  90. package/dist/esm/clientDefinitions.js.map +1 -0
  91. package/dist/esm/index.d.ts +11 -0
  92. package/dist/esm/index.d.ts.map +1 -0
  93. package/dist/esm/index.js +13 -0
  94. package/dist/esm/index.js.map +1 -0
  95. package/dist/esm/isUnexpected.d.ts +16 -0
  96. package/dist/esm/isUnexpected.d.ts.map +1 -0
  97. package/dist/esm/isUnexpected.js +82 -0
  98. package/dist/esm/isUnexpected.js.map +1 -0
  99. package/dist/esm/logger.d.ts +2 -0
  100. package/dist/esm/logger.d.ts.map +1 -0
  101. package/dist/esm/logger.js +5 -0
  102. package/dist/esm/logger.js.map +1 -0
  103. package/dist/esm/models.d.ts +70 -0
  104. package/dist/esm/models.d.ts.map +1 -0
  105. package/dist/esm/models.js +4 -0
  106. package/dist/esm/models.js.map +1 -0
  107. package/dist/esm/outputModels.d.ts +325 -0
  108. package/dist/esm/outputModels.d.ts.map +1 -0
  109. package/dist/esm/outputModels.js +4 -0
  110. package/dist/esm/outputModels.js.map +1 -0
  111. package/dist/esm/package.json +3 -0
  112. package/dist/esm/paginateHelper.d.ts +68 -0
  113. package/dist/esm/paginateHelper.d.ts.map +1 -0
  114. package/dist/esm/paginateHelper.js +137 -0
  115. package/dist/esm/paginateHelper.js.map +1 -0
  116. package/dist/esm/parameters.d.ts +109 -0
  117. package/dist/esm/parameters.d.ts.map +1 -0
  118. package/dist/esm/parameters.js +4 -0
  119. package/dist/esm/parameters.js.map +1 -0
  120. package/dist/esm/purviewWorkflow.d.ts +16 -0
  121. package/dist/esm/purviewWorkflow.d.ts.map +1 -0
  122. package/dist/esm/purviewWorkflow.js +45 -0
  123. package/dist/esm/purviewWorkflow.js.map +1 -0
  124. package/dist/esm/responses.d.ts +137 -0
  125. package/dist/esm/responses.d.ts.map +1 -0
  126. package/dist/esm/responses.js +4 -0
  127. package/dist/esm/responses.js.map +1 -0
  128. package/dist/react-native/clientDefinitions.d.ts +85 -0
  129. package/dist/react-native/clientDefinitions.d.ts.map +1 -0
  130. package/dist/react-native/clientDefinitions.js +4 -0
  131. package/dist/react-native/clientDefinitions.js.map +1 -0
  132. package/dist/react-native/index.d.ts +11 -0
  133. package/dist/react-native/index.d.ts.map +1 -0
  134. package/dist/react-native/index.js +13 -0
  135. package/dist/react-native/index.js.map +1 -0
  136. package/dist/react-native/isUnexpected.d.ts +16 -0
  137. package/dist/react-native/isUnexpected.d.ts.map +1 -0
  138. package/dist/react-native/isUnexpected.js +82 -0
  139. package/dist/react-native/isUnexpected.js.map +1 -0
  140. package/dist/react-native/logger.d.ts +2 -0
  141. package/dist/react-native/logger.d.ts.map +1 -0
  142. package/dist/react-native/logger.js +5 -0
  143. package/dist/react-native/logger.js.map +1 -0
  144. package/dist/react-native/models.d.ts +70 -0
  145. package/dist/react-native/models.d.ts.map +1 -0
  146. package/dist/react-native/models.js +4 -0
  147. package/dist/react-native/models.js.map +1 -0
  148. package/dist/react-native/outputModels.d.ts +325 -0
  149. package/dist/react-native/outputModels.d.ts.map +1 -0
  150. package/dist/react-native/outputModels.js +4 -0
  151. package/dist/react-native/outputModels.js.map +1 -0
  152. package/dist/react-native/package.json +3 -0
  153. package/dist/react-native/paginateHelper.d.ts +68 -0
  154. package/dist/react-native/paginateHelper.d.ts.map +1 -0
  155. package/dist/react-native/paginateHelper.js +137 -0
  156. package/dist/react-native/paginateHelper.js.map +1 -0
  157. package/dist/react-native/parameters.d.ts +109 -0
  158. package/dist/react-native/parameters.d.ts.map +1 -0
  159. package/dist/react-native/parameters.js +4 -0
  160. package/dist/react-native/parameters.js.map +1 -0
  161. package/dist/react-native/purviewWorkflow.d.ts +16 -0
  162. package/dist/react-native/purviewWorkflow.d.ts.map +1 -0
  163. package/dist/react-native/purviewWorkflow.js +45 -0
  164. package/dist/react-native/purviewWorkflow.js.map +1 -0
  165. package/dist/react-native/responses.d.ts +137 -0
  166. package/dist/react-native/responses.d.ts.map +1 -0
  167. package/dist/react-native/responses.js +4 -0
  168. package/dist/react-native/responses.js.map +1 -0
  169. package/package.json +84 -76
  170. package/review/{purview-workflow.api.md → purview-workflow-node.api.md} +26 -20
  171. package/dist/index.js +0 -188
  172. package/dist/index.js.map +0 -1
  173. package/dist-esm/src/clientDefinitions.js +0 -4
  174. package/dist-esm/src/clientDefinitions.js.map +0 -1
  175. package/dist-esm/src/index.js +0 -13
  176. package/dist-esm/src/index.js.map +0 -1
  177. package/dist-esm/src/isUnexpected.js.map +0 -1
  178. package/dist-esm/src/models.js +0 -4
  179. package/dist-esm/src/outputModels.js +0 -4
  180. package/dist-esm/src/paginateHelper.js.map +0 -1
  181. package/dist-esm/src/parameters.js +0 -4
  182. package/dist-esm/src/parameters.js.map +0 -1
  183. package/dist-esm/src/purviewWorkflow.js +0 -27
  184. package/dist-esm/src/purviewWorkflow.js.map +0 -1
  185. package/dist-esm/src/responses.js +0 -4
  186. package/dist-esm/src/responses.js.map +0 -1
  187. package/types/purview-workflow.d.ts +0 -920
@@ -1 +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"]}
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,325 @@
1
+ /** The workflow list. */
2
+ export interface WorkflowMetadataListOutput {
3
+ /** The value of workflow list. */
4
+ value: Array<WorkflowMetadataOutput>;
5
+ /** The URL to get the next set of results. */
6
+ nextLink?: string;
7
+ }
8
+ /** The workflow metadata, action DAGs are not included. */
9
+ export interface WorkflowMetadataOutput {
10
+ /**
11
+ * The id of workflow.
12
+ *
13
+ * Value may contain a UUID
14
+ */
15
+ id: string;
16
+ /** It describes under what condition a workflow will run. */
17
+ triggers: Array<TriggerOutput>;
18
+ /** The created time of workflow. */
19
+ createdTime?: string;
20
+ /** The person who created the workflow. */
21
+ createdBy?: string;
22
+ /** The last update time. */
23
+ lastUpdateTime?: string;
24
+ /** The person who updated the workflow. */
25
+ updatedBy?: string;
26
+ /** The name of a workflow. */
27
+ name: string;
28
+ /** Whether the workflow is enabled or not. */
29
+ isEnabled: boolean;
30
+ /** Description of a workflow. */
31
+ description: string;
32
+ }
33
+ /** Describes under what condition a workflow will run. */
34
+ export interface TriggerOutput {
35
+ type: "when_term_creation_is_requested" | "when_term_deletion_is_requested" | "when_term_update_is_requested" | "when_terms_import_is_requested" | "when_data_access_grant_is_requested" | "when_asset_update_is_requested";
36
+ /** Glossary term hierarchy path. */
37
+ underGlossaryHierarchy?: string;
38
+ /** The collection name. */
39
+ underCollection?: string;
40
+ /** The glossary guid. */
41
+ underGlossary?: string;
42
+ }
43
+ /** Default error response model */
44
+ export interface ErrorResponseOutput {
45
+ /** Default error model */
46
+ error: ErrorModelOutput;
47
+ }
48
+ /** Default error model */
49
+ export interface ErrorModelOutput {
50
+ /** Gets or sets the code. */
51
+ code: string;
52
+ /** Gets or sets the details. */
53
+ details?: Array<ErrorModelOutput>;
54
+ /** Gets or sets the messages. */
55
+ message: string;
56
+ /** Gets or sets the target. */
57
+ target?: string;
58
+ }
59
+ /** The workflow properties. It includes the triggers, actual flow and other properties of a workflow. */
60
+ export interface WorkflowOutput extends WorkflowMetadataOutput {
61
+ /** The action DAG(Directed Acyclic Graph), it defines steps to be executed in a workflow run and their order. */
62
+ actionDag: Record<string, unknown>;
63
+ }
64
+ /** Describes user ask to do operation(s) on Purview. */
65
+ export interface UserRequestResponseOutput {
66
+ /**
67
+ * The user request id.
68
+ *
69
+ * Value may contain a UUID
70
+ */
71
+ requestId: string;
72
+ /**
73
+ * The person who submitted the user request.
74
+ *
75
+ * Value may contain a UUID
76
+ */
77
+ requestor: string;
78
+ /** The list of operations user want to submit, each operation matches one Purview API call and will do the operation directly. */
79
+ operations: Array<UserRequestResponseOperationsItemOutput>;
80
+ /** The comment when submit a user request. */
81
+ comment?: string;
82
+ /** The status. */
83
+ status: "NotStarted" | "InProgress" | "Failed" | "Completed" | "Canceling" | "CancellationFailed" | "Canceled";
84
+ }
85
+ /** The operation user wants to perform. */
86
+ export interface UserRequestResponseOperationsItemOutput {
87
+ /** The operation type. */
88
+ type: "CreateTerm" | "UpdateTerm" | "DeleteTerm" | "ImportTerms" | "UpdateAsset" | "GrantDataAccess";
89
+ /** The payload of each operation which user want to submit. */
90
+ payload: Record<string, unknown>;
91
+ workflowRunIds?: Array<string>;
92
+ }
93
+ export interface WorkflowRunListOutput {
94
+ /** The value of workflow run list. */
95
+ value: Array<WorkflowRunMetadataOutput>;
96
+ /** The URL to get the next set of results. */
97
+ nextLink?: string;
98
+ }
99
+ /** The execution of a workflow. It includes status of the entire run and other properties of a run. */
100
+ export interface WorkflowRunMetadataOutput {
101
+ /**
102
+ * The workflow run id.
103
+ *
104
+ * Value may contain a UUID
105
+ */
106
+ id: string;
107
+ /**
108
+ * The workflow id.
109
+ *
110
+ * Value may contain a UUID
111
+ */
112
+ workflowId: string;
113
+ /** Workflow run start time. */
114
+ startTime: string;
115
+ /**
116
+ * The person who submitted the user request.
117
+ *
118
+ * Value may contain a UUID
119
+ */
120
+ requestor: string;
121
+ /**
122
+ * The user request id.
123
+ *
124
+ * Value may contain a UUID
125
+ */
126
+ userRequestId?: string;
127
+ /** The input of a workflow run. Align with operation in user request. */
128
+ runPayload: WorkflowRunPayloadOutput;
129
+ /** The status. */
130
+ status: "NotStarted" | "InProgress" | "Failed" | "Completed" | "Canceling" | "CancellationFailed" | "Canceled";
131
+ /** The time of workflow run completed. */
132
+ endTime?: string;
133
+ /** The time of workflow run be canceled. */
134
+ cancelTime?: string;
135
+ /** The comment when cancel a workflow run. */
136
+ cancelComment?: string;
137
+ }
138
+ /** The input of a workflow run. Align with operation in user request. */
139
+ export interface WorkflowRunPayloadOutput {
140
+ /** The workflow run payload type. */
141
+ type: "CreateTerm" | "UpdateTerm" | "DeleteTerm" | "ImportTerms" | "UpdateAsset" | "GrantDataAccess";
142
+ /** The target value which need involve workflow to update. */
143
+ targetValue: string;
144
+ }
145
+ /** 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. */
146
+ export interface WorkflowRunOutput {
147
+ /**
148
+ * The workflow run id.
149
+ *
150
+ * Value may contain a UUID
151
+ */
152
+ id?: string;
153
+ /**
154
+ * The workflow id.
155
+ *
156
+ * Value may contain a UUID
157
+ */
158
+ workflowId?: string;
159
+ /** Workflow run start time. */
160
+ startTime?: string;
161
+ /**
162
+ * The person who submitted the user request.
163
+ *
164
+ * Value may contain a UUID
165
+ */
166
+ requestor?: string;
167
+ /**
168
+ * The user request id.
169
+ *
170
+ * Value may contain a UUID
171
+ */
172
+ userRequestId?: string;
173
+ /** The input of a workflow run. Align with operation in user request. */
174
+ runPayload?: WorkflowRunRunPayloadOutput;
175
+ /** The status. */
176
+ status?: "NotStarted" | "InProgress" | "Failed" | "Completed" | "Canceling" | "CancellationFailed" | "Canceled";
177
+ /** The time of workflow run completed. */
178
+ endTime?: string;
179
+ /** The time of workflow run be canceled. */
180
+ cancelTime?: string;
181
+ /** The comment when cancel a workflow run. */
182
+ cancelComment?: string;
183
+ /** The action DAG(Directed Acyclic Graph), it defines actual flow. */
184
+ actionDag: Record<string, unknown>;
185
+ /** It refers to the "detail" property of a workflow run object, which contains run context and runtime information of actions. */
186
+ detail: WorkflowRunDetailOutput;
187
+ }
188
+ /** The input of a workflow run. Align with operation in user request. */
189
+ export interface WorkflowRunRunPayloadOutput {
190
+ /** The workflow run payload type. */
191
+ type: "CreateTerm" | "UpdateTerm" | "DeleteTerm" | "ImportTerms" | "UpdateAsset" | "GrantDataAccess";
192
+ /** The target value which need involve workflow to update. */
193
+ targetValue: string;
194
+ /** The payload of each operation which user want to submit. */
195
+ payload: Record<string, unknown>;
196
+ }
197
+ /** It refers to the "detail" property of a workflow run object, which contains run context and runtime information of actions. */
198
+ export interface WorkflowRunDetailOutput {
199
+ /** Built-in variables starts with @runInput. Its properties are determined by trigger type at workflow run time. */
200
+ runInput: Record<string, unknown>;
201
+ /** Any object */
202
+ actions: Record<string, unknown>;
203
+ }
204
+ export interface TasksListOutput {
205
+ /** The value of workflow tasks list. */
206
+ value: Array<WorkflowTaskOutput>;
207
+ /** The URL to get the next set of results. */
208
+ nextLink?: string;
209
+ }
210
+ /** An actionable item assigned to assignees. It is created when approval or task action starts to execute. Approval is one kind of task. */
211
+ export interface WorkflowTaskOutputParent {
212
+ /**
213
+ * The workflow task id.
214
+ *
215
+ * Value may contain a UUID
216
+ */
217
+ id: string;
218
+ /** The workflow task title. */
219
+ title?: string;
220
+ /**
221
+ * The workflow run id.
222
+ *
223
+ * Value may contain a UUID
224
+ */
225
+ workflowRunId: string;
226
+ /**
227
+ * The workflow id.
228
+ *
229
+ * Value may contain a UUID
230
+ */
231
+ workflowId: string;
232
+ /**
233
+ * The person who submitted the user request.
234
+ *
235
+ * Value may contain a UUID
236
+ */
237
+ requestor: string;
238
+ /** The created time. */
239
+ createdTime: string;
240
+ /** The last update time. */
241
+ lastUpdateTime: string;
242
+ /** Info and material that helps assignees to take action. */
243
+ payload: TaskPayloadOutput;
244
+ /** Info of task reminder. */
245
+ reminderInfo?: WorkflowTaskReminderInfoOutput;
246
+ /** Info of task expiry. */
247
+ expiryInfo?: WorkflowTaskExpiryInfoOutput;
248
+ type: "WorkflowTask" | "Approval" | "SimpleTask";
249
+ }
250
+ /** Info and material that helps assignees to take action. */
251
+ export interface TaskPayloadOutput {
252
+ /** The task payload type. */
253
+ type: "CreateTerm" | "UpdateTerm" | "DeleteTerm" | "ImportTerms" | "UpdateAsset" | "GrantDataAccess";
254
+ /** The target value of entity which user want to involve workflow to update. */
255
+ targetValue: string;
256
+ /** The payload of the task. */
257
+ payload?: Record<string, unknown>;
258
+ }
259
+ /** Info of task reminder. */
260
+ export interface WorkflowTaskReminderInfoOutput {
261
+ /** The last update time. */
262
+ lastRemindTime?: string;
263
+ /** The next remind time. */
264
+ nextRemindTime: string;
265
+ /** The reminder settings. */
266
+ reminderSettings: Record<string, unknown>;
267
+ }
268
+ /** Info of task expiry. */
269
+ export interface WorkflowTaskExpiryInfoOutput {
270
+ /** The last expiry notification time. */
271
+ lastExpiryNotificationTime?: string;
272
+ /** The next expiry notification time. */
273
+ nextExpiryNotificationTime: string;
274
+ /** The expiry time. */
275
+ expiryTime: string;
276
+ expirySettings: WorkflowTaskExpiryInfoExpirySettingsOutput;
277
+ }
278
+ export interface WorkflowTaskExpiryInfoExpirySettingsOutput {
279
+ /** The time of expiry. */
280
+ expireAfter: Record<string, unknown>;
281
+ notifyOnExpiration?: Array<string>;
282
+ }
283
+ /** The workflow approval task properties. */
284
+ export interface ApprovalOutput extends WorkflowTaskOutputParent {
285
+ /** The approval task details */
286
+ approvalDetail?: ApprovalDetailOutput;
287
+ type: "Approval";
288
+ }
289
+ /** The approval task details */
290
+ export interface ApprovalDetailOutput {
291
+ /** The approval type of an approval task. */
292
+ approvalType: "PendingOnAny" | "PendingOnAll";
293
+ /** The status of an approval task. */
294
+ status: "Pending" | "Approved" | "Rejected" | "Canceled";
295
+ /** The list of approvers with reply. */
296
+ approvers: Record<string, ApproverResponseOutput>;
297
+ }
298
+ /** The response of approvers for a workflow task. */
299
+ export interface ApproverResponseOutput {
300
+ /** The response for an approval task. */
301
+ reply: "Approved" | "Rejected" | "Pending";
302
+ /** The comment of approving or rejecting an approval request. */
303
+ comment?: string;
304
+ /** The reply time of approver to a workflow task. */
305
+ responseTime?: string;
306
+ }
307
+ /** The workflow simple task properties. */
308
+ export interface SimpleTaskOutput extends WorkflowTaskOutputParent {
309
+ /** Workflow simple task details. */
310
+ taskDetail?: SimpleTaskDetailOutput;
311
+ type: "SimpleTask";
312
+ }
313
+ /** Workflow simple task details. */
314
+ export interface SimpleTaskDetailOutput {
315
+ /** The simple task body. */
316
+ taskBody: string;
317
+ /** The users or groups were assigned the simple task. */
318
+ assignedTo: Array<string>;
319
+ /** Simple task status. */
320
+ status: "NotStarted" | "InProgress" | "Completed" | "Canceled";
321
+ changeHistory: Array<Record<string, unknown>>;
322
+ }
323
+ /** An actionable item assigned to assignees. It is created when approval or task action starts to execute. Approval is one kind of task. */
324
+ export type WorkflowTaskOutput = ApprovalOutput | SimpleTaskOutput;
325
+ //# sourceMappingURL=outputModels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAGA,yBAAyB;AACzB,MAAM,WAAW,0BAA0B;IACzC,kCAAkC;IAClC,KAAK,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACrC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,2DAA2D;AAC3D,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,EAAE,EAAE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3C,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,2CAA2C;AAC3C,MAAM,WAAW,gBAAiB,SAAQ,wBAAwB;IAChE,oCAAoC;IACpC,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,oCAAoC;AACpC,MAAM,WAAW,sBAAsB;IACrC,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,0BAA0B;IAC1B,MAAM,EAAE,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC;IAC/D,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC/C;AAED,4IAA4I;AAC5I,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export {};
4
+ //# sourceMappingURL=outputModels.js.map
@@ -1 +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"]}
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"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,68 @@
1
+ import type { Client, PathUncheckedResponse } from "@azure-rest/core-client";
2
+ /**
3
+ * An interface that tracks the settings for paged iteration
4
+ */
5
+ export interface PageSettings {
6
+ /**
7
+ * The token that keeps track of where to continue the iterator
8
+ */
9
+ continuationToken?: string;
10
+ }
11
+ /**
12
+ * An interface that allows async iterable iteration both to completion and by page.
13
+ */
14
+ export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
15
+ /**
16
+ * The next method, part of the iteration protocol
17
+ */
18
+ next(): Promise<IteratorResult<TElement>>;
19
+ /**
20
+ * The connection to the async iterator, part of the iteration protocol
21
+ */
22
+ [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
23
+ /**
24
+ * Return an AsyncIterableIterator that works a page at a time
25
+ */
26
+ byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;
27
+ }
28
+ /**
29
+ * Helper type to extract the type of an array
30
+ */
31
+ export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
32
+ /**
33
+ * The type of a custom function that defines how to get a page and a link to the next one if any.
34
+ */
35
+ export type GetPage<TPage> = (pageLink: string) => Promise<{
36
+ page: TPage;
37
+ nextPageLink?: string;
38
+ }>;
39
+ /**
40
+ * Options for the paging helper
41
+ */
42
+ export interface PagingOptions<TResponse> {
43
+ /**
44
+ * Custom function to extract pagination details for crating the PagedAsyncIterableIterator
45
+ */
46
+ customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
47
+ }
48
+ /**
49
+ * Helper type to infer the Type of the paged elements from the response type
50
+ * This type is generated based on the swagger information for x-ms-pageable
51
+ * specifically on the itemName property which indicates the property of the response
52
+ * where the page items are found. The default value is `value`.
53
+ * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter
54
+ */
55
+ export type PaginateReturn<TResult> = TResult extends {
56
+ body: {
57
+ value?: infer TPage;
58
+ };
59
+ } ? GetArrayType<TPage> : Array<unknown>;
60
+ /**
61
+ * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
62
+ * @param client - Client to use for sending the next page requests
63
+ * @param initialResponse - Initial response containing the nextLink and current page of elements
64
+ * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
65
+ * @returns - PagedAsyncIterableIterator to iterate the elements
66
+ */
67
+ export declare function paginate<TResponse extends PathUncheckedResponse>(client: Client, initialResponse: TResponse, options?: PagingOptions<TResponse>): PagedAsyncIterableIterator<PaginateReturn<TResponse>>;
68
+ //# sourceMappingURL=paginateHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paginateHelper.d.ts","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAuF7E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;C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AAM,GACrC,0BAA0B,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA0BvD"}
@@ -1,7 +1,74 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { getPagedAsyncIterator } from "@azure/core-paging";
2
+ // Licensed under the MIT License.
4
3
  import { createRestError } from "@azure-rest/core-client";
4
+ /**
5
+ * returns an async iterator that iterates over results. It also has a `byPage`
6
+ * method that returns pages of items at once.
7
+ *
8
+ * @param pagedResult - an object that specifies how to get pages.
9
+ * @returns a paged async iterator that iterates over results.
10
+ */
11
+ function getPagedAsyncIterator(pagedResult) {
12
+ const iter = getItemAsyncIterator(pagedResult);
13
+ return {
14
+ next() {
15
+ return iter.next();
16
+ },
17
+ [Symbol.asyncIterator]() {
18
+ return this;
19
+ },
20
+ byPage: pagedResult?.byPage ??
21
+ ((settings) => {
22
+ const { continuationToken } = settings ?? {};
23
+ return getPageAsyncIterator(pagedResult, {
24
+ pageLink: continuationToken,
25
+ });
26
+ }),
27
+ };
28
+ }
29
+ async function* getItemAsyncIterator(pagedResult) {
30
+ const pages = getPageAsyncIterator(pagedResult);
31
+ const firstVal = await pages.next();
32
+ // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is
33
+ if (!Array.isArray(firstVal.value)) {
34
+ // can extract elements from this page
35
+ const { toElements } = pagedResult;
36
+ if (toElements) {
37
+ yield* toElements(firstVal.value);
38
+ for await (const page of pages) {
39
+ yield* toElements(page);
40
+ }
41
+ }
42
+ else {
43
+ yield firstVal.value;
44
+ // `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case
45
+ yield* pages;
46
+ }
47
+ }
48
+ else {
49
+ yield* firstVal.value;
50
+ for await (const page of pages) {
51
+ // pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,
52
+ // it must be the case that `TPage = TElement[]`
53
+ yield* page;
54
+ }
55
+ }
56
+ }
57
+ async function* getPageAsyncIterator(pagedResult, options = {}) {
58
+ const { pageLink } = options;
59
+ let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);
60
+ if (!response) {
61
+ return;
62
+ }
63
+ yield response.page;
64
+ while (response.nextPageLink) {
65
+ response = await pagedResult.getPage(response.nextPageLink);
66
+ if (!response) {
67
+ return;
68
+ }
69
+ yield response.page;
70
+ }
71
+ }
5
72
  /**
6
73
  * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
7
74
  * @param client - Client to use for sending the next page requests
@@ -56,7 +123,7 @@ function getElements(body, itemName) {
56
123
  if (!Array.isArray(value)) {
57
124
  throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
58
125
  }
59
- return value !== null && value !== void 0 ? value : [];
126
+ return value ?? [];
60
127
  }
61
128
  /**
62
129
  * Checks if a request failed
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;GAMG;AACH,SAAS,qBAAqB,CAM5B,WAAqD;IAErD,MAAM,IAAI,GAAG,oBAAoB,CAAwC,WAAW,CAAC,CAAC;IACtF,OAAO;QACL,IAAI;YACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EACJ,WAAW,EAAE,MAAM;YAClB,CAAC,CAAC,QAAuB,EAAE,EAAE;gBAC5B,MAAM,EAAE,iBAAiB,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAC;gBAC7C,OAAO,oBAAoB,CAAC,WAAW,EAAE;oBACvC,QAAQ,EAAE,iBAAiD;iBAC5D,CAAC,CAAC;YACL,CAAC,CAA2E;KAC/E,CAAC;AACJ,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,oBAAoB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QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,kCAAkC,CAAC,CAAC;IACnF,CAAC;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,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,IAAI,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,CAAC;QAClD,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } from \"@azure-rest/core-client\";\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n TLink = string,\n>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n (((settings?: PageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken as unknown as TLink | undefined,\n });\n }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator<TPage>),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n const firstVal = await pages.next();\n // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is\n if (!Array.isArray(firstVal.value)) {\n // can extract elements from this page\n const { toElements } = pagedResult;\n if (toElements) {\n yield* toElements(firstVal.value) as TElement[];\n for await (const page of pages) {\n yield* toElements(page) as TElement[];\n }\n } else {\n yield firstVal.value;\n // `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case\n yield* pages as unknown as AsyncIterableIterator<TElement>;\n }\n } else {\n yield* firstVal.value;\n for await (const page of pages) {\n // pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,\n // it must be the case that `TPage = TElement[]`\n yield* page as unknown as TElement[];\n }\n }\n}\n\nasync function* getPageAsyncIterator<TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n options: {\n pageLink?: TLink;\n } = {},\n): AsyncIterableIterator<TPage> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n }\n}\n\n/**\n * An interface that tracks the settings for paged iteration\n */\nexport interface PageSettings {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\ninterface PagedResult<TPage, TPageSettings = PageSettings, TLink = string> {\n /**\n * Link to the first page of results.\n */\n firstPageLink: TLink;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => unknown[];\n}\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> = (pageLink: string) => 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"]}