@azure-rest/health-deidentification 1.0.0-beta.1 → 1.0.0

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 (165) hide show
  1. package/LICENSE +4 -4
  2. package/README.md +153 -35
  3. package/dist/browser/clientDefinitions.d.ts +7 -7
  4. package/dist/browser/clientDefinitions.d.ts.map +1 -1
  5. package/dist/browser/clientDefinitions.js +1 -1
  6. package/dist/browser/clientDefinitions.js.map +1 -1
  7. package/dist/browser/deidentificationClient.d.ts +3 -3
  8. package/dist/browser/deidentificationClient.d.ts.map +1 -1
  9. package/dist/browser/deidentificationClient.js +3 -3
  10. package/dist/browser/deidentificationClient.js.map +1 -1
  11. package/dist/browser/index.js +1 -1
  12. package/dist/browser/index.js.map +1 -1
  13. package/dist/browser/isUnexpected.d.ts +3 -3
  14. package/dist/browser/isUnexpected.d.ts.map +1 -1
  15. package/dist/browser/isUnexpected.js +1 -1
  16. package/dist/browser/isUnexpected.js.map +1 -1
  17. package/dist/browser/logger.js +1 -1
  18. package/dist/browser/logger.js.map +1 -1
  19. package/dist/browser/models.d.ts +45 -28
  20. package/dist/browser/models.d.ts.map +1 -1
  21. package/dist/browser/models.js +1 -1
  22. package/dist/browser/models.js.map +1 -1
  23. package/dist/browser/outputModels.d.ts +56 -40
  24. package/dist/browser/outputModels.d.ts.map +1 -1
  25. package/dist/browser/outputModels.js +1 -1
  26. package/dist/browser/outputModels.js.map +1 -1
  27. package/dist/browser/paginateHelper.d.ts +28 -3
  28. package/dist/browser/paginateHelper.d.ts.map +1 -1
  29. package/dist/browser/paginateHelper.js +99 -2
  30. package/dist/browser/paginateHelper.js.map +1 -1
  31. package/dist/browser/parameters.d.ts +17 -10
  32. package/dist/browser/parameters.d.ts.map +1 -1
  33. package/dist/browser/parameters.js +1 -1
  34. package/dist/browser/parameters.js.map +1 -1
  35. package/dist/browser/pollingHelper.d.ts +5 -5
  36. package/dist/browser/pollingHelper.d.ts.map +1 -1
  37. package/dist/browser/pollingHelper.js +2 -2
  38. package/dist/browser/pollingHelper.js.map +1 -1
  39. package/dist/browser/responses.d.ts +24 -19
  40. package/dist/browser/responses.d.ts.map +1 -1
  41. package/dist/browser/responses.js +1 -1
  42. package/dist/browser/responses.js.map +1 -1
  43. package/dist/commonjs/clientDefinitions.d.ts +7 -7
  44. package/dist/commonjs/clientDefinitions.d.ts.map +1 -1
  45. package/dist/commonjs/clientDefinitions.js +1 -1
  46. package/dist/commonjs/clientDefinitions.js.map +1 -1
  47. package/dist/commonjs/deidentificationClient.d.ts +3 -3
  48. package/dist/commonjs/deidentificationClient.d.ts.map +1 -1
  49. package/dist/commonjs/deidentificationClient.js +3 -3
  50. package/dist/commonjs/deidentificationClient.js.map +1 -1
  51. package/dist/commonjs/index.js +1 -1
  52. package/dist/commonjs/index.js.map +1 -1
  53. package/dist/commonjs/isUnexpected.d.ts +3 -3
  54. package/dist/commonjs/isUnexpected.d.ts.map +1 -1
  55. package/dist/commonjs/isUnexpected.js +1 -1
  56. package/dist/commonjs/isUnexpected.js.map +1 -1
  57. package/dist/commonjs/logger.js +1 -1
  58. package/dist/commonjs/logger.js.map +1 -1
  59. package/dist/commonjs/models.d.ts +45 -28
  60. package/dist/commonjs/models.d.ts.map +1 -1
  61. package/dist/commonjs/models.js +1 -1
  62. package/dist/commonjs/models.js.map +1 -1
  63. package/dist/commonjs/outputModels.d.ts +56 -40
  64. package/dist/commonjs/outputModels.d.ts.map +1 -1
  65. package/dist/commonjs/outputModels.js +1 -1
  66. package/dist/commonjs/outputModels.js.map +1 -1
  67. package/dist/commonjs/paginateHelper.d.ts +28 -3
  68. package/dist/commonjs/paginateHelper.d.ts.map +1 -1
  69. package/dist/commonjs/paginateHelper.js +100 -3
  70. package/dist/commonjs/paginateHelper.js.map +1 -1
  71. package/dist/commonjs/parameters.d.ts +17 -10
  72. package/dist/commonjs/parameters.d.ts.map +1 -1
  73. package/dist/commonjs/parameters.js +1 -1
  74. package/dist/commonjs/parameters.js.map +1 -1
  75. package/dist/commonjs/pollingHelper.d.ts +5 -5
  76. package/dist/commonjs/pollingHelper.d.ts.map +1 -1
  77. package/dist/commonjs/pollingHelper.js +1 -1
  78. package/dist/commonjs/pollingHelper.js.map +1 -1
  79. package/dist/commonjs/responses.d.ts +24 -19
  80. package/dist/commonjs/responses.d.ts.map +1 -1
  81. package/dist/commonjs/responses.js +1 -1
  82. package/dist/commonjs/responses.js.map +1 -1
  83. package/dist/commonjs/tsdoc-metadata.json +1 -1
  84. package/dist/esm/clientDefinitions.d.ts +7 -7
  85. package/dist/esm/clientDefinitions.d.ts.map +1 -1
  86. package/dist/esm/clientDefinitions.js +1 -1
  87. package/dist/esm/clientDefinitions.js.map +1 -1
  88. package/dist/esm/deidentificationClient.d.ts +3 -3
  89. package/dist/esm/deidentificationClient.d.ts.map +1 -1
  90. package/dist/esm/deidentificationClient.js +3 -3
  91. package/dist/esm/deidentificationClient.js.map +1 -1
  92. package/dist/esm/index.js +1 -1
  93. package/dist/esm/index.js.map +1 -1
  94. package/dist/esm/isUnexpected.d.ts +3 -3
  95. package/dist/esm/isUnexpected.d.ts.map +1 -1
  96. package/dist/esm/isUnexpected.js +1 -1
  97. package/dist/esm/isUnexpected.js.map +1 -1
  98. package/dist/esm/logger.js +1 -1
  99. package/dist/esm/logger.js.map +1 -1
  100. package/dist/esm/models.d.ts +45 -28
  101. package/dist/esm/models.d.ts.map +1 -1
  102. package/dist/esm/models.js +1 -1
  103. package/dist/esm/models.js.map +1 -1
  104. package/dist/esm/outputModels.d.ts +56 -40
  105. package/dist/esm/outputModels.d.ts.map +1 -1
  106. package/dist/esm/outputModels.js +1 -1
  107. package/dist/esm/outputModels.js.map +1 -1
  108. package/dist/esm/paginateHelper.d.ts +28 -3
  109. package/dist/esm/paginateHelper.d.ts.map +1 -1
  110. package/dist/esm/paginateHelper.js +99 -2
  111. package/dist/esm/paginateHelper.js.map +1 -1
  112. package/dist/esm/parameters.d.ts +17 -10
  113. package/dist/esm/parameters.d.ts.map +1 -1
  114. package/dist/esm/parameters.js +1 -1
  115. package/dist/esm/parameters.js.map +1 -1
  116. package/dist/esm/pollingHelper.d.ts +5 -5
  117. package/dist/esm/pollingHelper.d.ts.map +1 -1
  118. package/dist/esm/pollingHelper.js +2 -2
  119. package/dist/esm/pollingHelper.js.map +1 -1
  120. package/dist/esm/responses.d.ts +24 -19
  121. package/dist/esm/responses.d.ts.map +1 -1
  122. package/dist/esm/responses.js +1 -1
  123. package/dist/esm/responses.js.map +1 -1
  124. package/dist/react-native/clientDefinitions.d.ts +7 -7
  125. package/dist/react-native/clientDefinitions.d.ts.map +1 -1
  126. package/dist/react-native/clientDefinitions.js +1 -1
  127. package/dist/react-native/clientDefinitions.js.map +1 -1
  128. package/dist/react-native/deidentificationClient.d.ts +3 -3
  129. package/dist/react-native/deidentificationClient.d.ts.map +1 -1
  130. package/dist/react-native/deidentificationClient.js +3 -3
  131. package/dist/react-native/deidentificationClient.js.map +1 -1
  132. package/dist/react-native/index.js +1 -1
  133. package/dist/react-native/index.js.map +1 -1
  134. package/dist/react-native/isUnexpected.d.ts +3 -3
  135. package/dist/react-native/isUnexpected.d.ts.map +1 -1
  136. package/dist/react-native/isUnexpected.js +1 -1
  137. package/dist/react-native/isUnexpected.js.map +1 -1
  138. package/dist/react-native/logger.js +1 -1
  139. package/dist/react-native/logger.js.map +1 -1
  140. package/dist/react-native/models.d.ts +45 -28
  141. package/dist/react-native/models.d.ts.map +1 -1
  142. package/dist/react-native/models.js +1 -1
  143. package/dist/react-native/models.js.map +1 -1
  144. package/dist/react-native/outputModels.d.ts +56 -40
  145. package/dist/react-native/outputModels.d.ts.map +1 -1
  146. package/dist/react-native/outputModels.js +1 -1
  147. package/dist/react-native/outputModels.js.map +1 -1
  148. package/dist/react-native/paginateHelper.d.ts +28 -3
  149. package/dist/react-native/paginateHelper.d.ts.map +1 -1
  150. package/dist/react-native/paginateHelper.js +99 -2
  151. package/dist/react-native/paginateHelper.js.map +1 -1
  152. package/dist/react-native/parameters.d.ts +17 -10
  153. package/dist/react-native/parameters.d.ts.map +1 -1
  154. package/dist/react-native/parameters.js +1 -1
  155. package/dist/react-native/parameters.js.map +1 -1
  156. package/dist/react-native/pollingHelper.d.ts +5 -5
  157. package/dist/react-native/pollingHelper.d.ts.map +1 -1
  158. package/dist/react-native/pollingHelper.js +2 -2
  159. package/dist/react-native/pollingHelper.js.map +1 -1
  160. package/dist/react-native/responses.d.ts +24 -19
  161. package/dist/react-native/responses.d.ts.map +1 -1
  162. package/dist/react-native/responses.js +1 -1
  163. package/dist/react-native/responses.js.map +1 -1
  164. package/package.json +45 -51
  165. package/review/health-deidentification.api.md +0 -645
@@ -1,23 +1,17 @@
1
1
  /** A job containing a batch of documents to de-identify. */
2
2
  export interface DeidentificationJob {
3
- /** Storage location to perform the operation on. */
4
- sourceLocation: SourceStorageLocation;
5
- /** Target location to store output of operation. */
6
- targetLocation: TargetStorageLocation;
7
3
  /**
8
4
  * Operation to perform on the input documents.
9
5
  *
10
6
  * Possible values: "Redact", "Surrogate", "Tag"
11
7
  */
12
- operation?: OperationType;
13
- /**
14
- * Data type of the input documents.
15
- *
16
- * Possible values: "Plaintext"
17
- */
18
- dataType?: DocumentDataType;
19
- /** Format of the redacted output. Only valid when Operation is Redact. */
20
- redactionFormat?: string;
8
+ operation?: DeidentificationOperationType;
9
+ /** Storage location to perform the operation on. */
10
+ sourceLocation: SourceStorageLocation;
11
+ /** Target location to store output of operation. */
12
+ targetLocation: TargetStorageLocation;
13
+ /** Customization parameters to override default service behaviors. */
14
+ customizations?: DeidentificationJobCustomizationOptions;
21
15
  }
22
16
  /** Storage location. */
23
17
  export interface SourceStorageLocation {
@@ -32,11 +26,32 @@ export interface SourceStorageLocation {
32
26
  export interface TargetStorageLocation {
33
27
  /** URL to storage location. */
34
28
  location: string;
35
- /** Prefix to filter path by. */
29
+ /**
30
+ * Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure.
31
+ *
32
+ * Example:
33
+ * File full path: documents/user/note.txt
34
+ * Input Prefix: "documents/user/"
35
+ * Output Prefix: "output_docs/"
36
+ *
37
+ * Output file: "output_docs/note.txt"
38
+ */
36
39
  prefix: string;
40
+ /** When set to true during a job, the service will overwrite the output location if it already exists. */
41
+ overwrite?: boolean;
42
+ }
43
+ /** Customizations options to override default service behaviors for job usage. */
44
+ export interface DeidentificationJobCustomizationOptions {
45
+ /**
46
+ * Format of the redacted output. Only valid when Operation is Redact.
47
+ * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.
48
+ */
49
+ redactionFormat?: string;
50
+ /** Locale in which the output surrogates are written. */
51
+ surrogateLocale?: string;
37
52
  }
38
53
  /** Summary metrics of a job. */
39
- export interface JobSummary {
54
+ export interface DeidentificationJobSummary {
40
55
  /** Number of documents that have completed. */
41
56
  successful: number;
42
57
  /** Number of documents that have failed. */
@@ -53,24 +68,26 @@ export interface DeidentificationContent {
53
68
  /** Input text to de-identify. */
54
69
  inputText: string;
55
70
  /**
56
- * Operation to perform on the input.
71
+ * Operation to perform on the input documents.
57
72
  *
58
73
  * Possible values: "Redact", "Surrogate", "Tag"
59
74
  */
60
- operation?: OperationType;
75
+ operation?: DeidentificationOperationType;
76
+ /** Customization parameters to override default service behaviors. */
77
+ customizations?: DeidentificationCustomizationOptions;
78
+ }
79
+ /** Customizations options to override default service behaviors for synchronous usage. */
80
+ export interface DeidentificationCustomizationOptions {
61
81
  /**
62
- * Data type of the input.
63
- *
64
- * Possible values: "Plaintext"
82
+ * Format of the redacted output. Only valid when Operation is Redact.
83
+ * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.
65
84
  */
66
- dataType?: DocumentDataType;
67
- /** Format of the redacted output. Only valid when OperationType is "Redact". */
68
85
  redactionFormat?: string;
86
+ /** Locale in which the output surrogates are written. */
87
+ surrogateLocale?: string;
69
88
  }
70
- /** Alias for OperationType */
71
- export type OperationType = string;
72
- /** Alias for DocumentDataType */
73
- export type DocumentDataType = string;
74
- /** Alias for JobStatus */
75
- export type JobStatus = string;
89
+ /** Alias for DeidentificationOperationType */
90
+ export type DeidentificationOperationType = string;
91
+ /** Alias for OperationState */
92
+ export type OperationState = string;
76
93
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAGA,4DAA4D;AAC5D,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,cAAc,EAAE,qBAAqB,CAAC;IACtC,oDAAoD;IACpD,cAAc,EAAE,qBAAqB,CAAC;IACtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAwB;AACxB,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAwB;AACxB,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,gCAAgC;AAChC,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IA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,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,6BAA6B,CAAC;IAC1C,sEAAsE;IACtE,cAAc,CAAC,EAAE,oCAAoC,CAAC;CACvD;AAED,0FAA0F;AAC1F,MAAM,WAAW,oCAAoC;IACnD;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,8CAA8C;AAC9C,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC;AACnD,+BAA+B;AAC/B,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  //# sourceMappingURL=models.js.map
@@ -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/** A job containing a batch of documents to de-identify. */\nexport interface DeidentificationJob {\n /** Storage location to perform the operation on. */\n sourceLocation: SourceStorageLocation;\n /** Target location to store output of operation. */\n targetLocation: TargetStorageLocation;\n /**\n * Operation to perform on the input documents.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: OperationType;\n /**\n * Data type of the input documents.\n *\n * Possible values: \"Plaintext\"\n */\n dataType?: DocumentDataType;\n /** Format of the redacted output. Only valid when Operation is Redact. */\n redactionFormat?: string;\n}\n\n/** Storage location. */\nexport interface SourceStorageLocation {\n /** URL to storage location. */\n location: string;\n /** Prefix to filter path by. */\n prefix: string;\n /** List of extensions to filter path by. */\n extensions?: string[];\n}\n\n/** Storage location. */\nexport interface TargetStorageLocation {\n /** URL to storage location. */\n location: string;\n /** Prefix to filter path by. */\n prefix: string;\n}\n\n/** Summary metrics of a job. */\nexport interface JobSummary {\n /** Number of documents that have completed. */\n successful: number;\n /** Number of documents that have failed. */\n failed: number;\n /** Number of documents that have been canceled. */\n canceled: number;\n /** Number of documents total. */\n total: number;\n /** Number of bytes processed. */\n bytesProcessed: number;\n}\n\n/** Request body for de-identification operation. */\nexport interface DeidentificationContent {\n /** Input text to de-identify. */\n inputText: string;\n /**\n * Operation to perform on the input.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: OperationType;\n /**\n * Data type of the input.\n *\n * Possible values: \"Plaintext\"\n */\n dataType?: DocumentDataType;\n /** Format of the redacted output. Only valid when OperationType is \"Redact\". */\n redactionFormat?: string;\n}\n\n/** Alias for OperationType */\nexport type OperationType = string;\n/** Alias for DocumentDataType */\nexport type DocumentDataType = string;\n/** Alias for JobStatus */\nexport type JobStatus = string;\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/** A job containing a batch of documents to de-identify. */\nexport interface DeidentificationJob {\n /**\n * Operation to perform on the input documents.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: DeidentificationOperationType;\n /** Storage location to perform the operation on. */\n sourceLocation: SourceStorageLocation;\n /** Target location to store output of operation. */\n targetLocation: TargetStorageLocation;\n /** Customization parameters to override default service behaviors. */\n customizations?: DeidentificationJobCustomizationOptions;\n}\n\n/** Storage location. */\nexport interface SourceStorageLocation {\n /** URL to storage location. */\n location: string;\n /** Prefix to filter path by. */\n prefix: string;\n /** List of extensions to filter path by. */\n extensions?: string[];\n}\n\n/** Storage location. */\nexport interface TargetStorageLocation {\n /** URL to storage location. */\n location: string;\n /**\n * Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure.\n *\n * Example:\n * File full path: documents/user/note.txt\n * Input Prefix: \"documents/user/\"\n * Output Prefix: \"output_docs/\"\n *\n * Output file: \"output_docs/note.txt\"\n */\n prefix: string;\n /** When set to true during a job, the service will overwrite the output location if it already exists. */\n overwrite?: boolean;\n}\n\n/** Customizations options to override default service behaviors for job usage. */\nexport interface DeidentificationJobCustomizationOptions {\n /**\n * Format of the redacted output. Only valid when Operation is Redact.\n * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.\n */\n redactionFormat?: string;\n /** Locale in which the output surrogates are written. */\n surrogateLocale?: string;\n}\n\n/** Summary metrics of a job. */\nexport interface DeidentificationJobSummary {\n /** Number of documents that have completed. */\n successful: number;\n /** Number of documents that have failed. */\n failed: number;\n /** Number of documents that have been canceled. */\n canceled: number;\n /** Number of documents total. */\n total: number;\n /** Number of bytes processed. */\n bytesProcessed: number;\n}\n\n/** Request body for de-identification operation. */\nexport interface DeidentificationContent {\n /** Input text to de-identify. */\n inputText: string;\n /**\n * Operation to perform on the input documents.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: DeidentificationOperationType;\n /** Customization parameters to override default service behaviors. */\n customizations?: DeidentificationCustomizationOptions;\n}\n\n/** Customizations options to override default service behaviors for synchronous usage. */\nexport interface DeidentificationCustomizationOptions {\n /**\n * Format of the redacted output. Only valid when Operation is Redact.\n * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.\n */\n redactionFormat?: string;\n /** Locale in which the output surrogates are written. */\n surrogateLocale?: string;\n}\n\n/** Alias for DeidentificationOperationType */\nexport type DeidentificationOperationType = string;\n/** Alias for OperationState */\nexport type OperationState = string;\n"]}
@@ -1,33 +1,26 @@
1
- import { Paged } from "@azure/core-paging";
2
- import { ErrorModel } from "@azure-rest/core-client";
1
+ import type { ErrorModel } from "@azure-rest/core-client";
3
2
  /** A job containing a batch of documents to de-identify. */
4
3
  export interface DeidentificationJobOutput {
5
4
  /** The name of a job. */
6
5
  readonly name: string;
7
- /** Storage location to perform the operation on. */
8
- sourceLocation: SourceStorageLocationOutput;
9
- /** Target location to store output of operation. */
10
- targetLocation: TargetStorageLocationOutput;
11
6
  /**
12
7
  * Operation to perform on the input documents.
13
8
  *
14
9
  * Possible values: "Redact", "Surrogate", "Tag"
15
10
  */
16
- operation?: OperationTypeOutput;
17
- /**
18
- * Data type of the input documents.
19
- *
20
- * Possible values: "Plaintext"
21
- */
22
- dataType?: DocumentDataTypeOutput;
23
- /** Format of the redacted output. Only valid when Operation is Redact. */
24
- redactionFormat?: string;
11
+ operation?: DeidentificationOperationTypeOutput;
12
+ /** Storage location to perform the operation on. */
13
+ sourceLocation: SourceStorageLocationOutput;
14
+ /** Target location to store output of operation. */
15
+ targetLocation: TargetStorageLocationOutput;
16
+ /** Customization parameters to override default service behaviors. */
17
+ customizations?: DeidentificationJobCustomizationOptionsOutput;
25
18
  /**
26
19
  * Current status of a job.
27
20
  *
28
- * Possible values: "NotStarted", "Running", "Succeeded", "PartialFailed", "Failed", "Canceled"
21
+ * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled"
29
22
  */
30
- readonly status: JobStatusOutput;
23
+ readonly status: OperationStateOutput;
31
24
  /** Error when job fails in it's entirety. */
32
25
  readonly error?: ErrorModel;
33
26
  /**
@@ -43,7 +36,7 @@ export interface DeidentificationJobOutput {
43
36
  /** Date and time when the job was started. */
44
37
  readonly startedAt?: string;
45
38
  /** Summary of a job. Exists only when the job is completed. */
46
- readonly summary?: JobSummaryOutput;
39
+ readonly summary?: DeidentificationJobSummaryOutput;
47
40
  }
48
41
  /** Storage location. */
49
42
  export interface SourceStorageLocationOutput {
@@ -58,11 +51,32 @@ export interface SourceStorageLocationOutput {
58
51
  export interface TargetStorageLocationOutput {
59
52
  /** URL to storage location. */
60
53
  location: string;
61
- /** Prefix to filter path by. */
54
+ /**
55
+ * Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure.
56
+ *
57
+ * Example:
58
+ * File full path: documents/user/note.txt
59
+ * Input Prefix: "documents/user/"
60
+ * Output Prefix: "output_docs/"
61
+ *
62
+ * Output file: "output_docs/note.txt"
63
+ */
62
64
  prefix: string;
65
+ /** When set to true during a job, the service will overwrite the output location if it already exists. */
66
+ overwrite?: boolean;
67
+ }
68
+ /** Customizations options to override default service behaviors for job usage. */
69
+ export interface DeidentificationJobCustomizationOptionsOutput {
70
+ /**
71
+ * Format of the redacted output. Only valid when Operation is Redact.
72
+ * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.
73
+ */
74
+ redactionFormat?: string;
75
+ /** Locale in which the output surrogates are written. */
76
+ surrogateLocale?: string;
63
77
  }
64
78
  /** Summary metrics of a job. */
65
- export interface JobSummaryOutput {
79
+ export interface DeidentificationJobSummaryOutput {
66
80
  /** Number of documents that have completed. */
67
81
  successful: number;
68
82
  /** Number of documents that have failed. */
@@ -74,14 +88,28 @@ export interface JobSummaryOutput {
74
88
  /** Number of bytes processed. */
75
89
  bytesProcessed: number;
76
90
  }
91
+ /** Paged collection of DeidentificationJob items */
92
+ export interface PagedDeidentificationJobOutput {
93
+ /** The DeidentificationJob items on this page */
94
+ value: Array<DeidentificationJobOutput>;
95
+ /** The link to the next page of items */
96
+ nextLink?: string;
97
+ }
98
+ /** Paged collection of DeidentificationDocumentDetails items */
99
+ export interface PagedDeidentificationDocumentDetailsOutput {
100
+ /** The DeidentificationDocumentDetails items on this page */
101
+ value: Array<DeidentificationDocumentDetailsOutput>;
102
+ /** The link to the next page of items */
103
+ nextLink?: string;
104
+ }
77
105
  /** Details of a single document in a job. */
78
- export interface DocumentDetailsOutput {
106
+ export interface DeidentificationDocumentDetailsOutput {
79
107
  /** Id of the document details. */
80
108
  readonly id: string;
81
109
  /** Location for the input. */
82
- input: DocumentLocationOutput;
110
+ input: DeidentificationDocumentLocationOutput;
83
111
  /** Location for the output. */
84
- output?: DocumentLocationOutput;
112
+ output?: DeidentificationDocumentLocationOutput;
85
113
  /**
86
114
  * Status of the document.
87
115
  *
@@ -92,9 +120,9 @@ export interface DocumentDetailsOutput {
92
120
  error?: ErrorModel;
93
121
  }
94
122
  /** Location of a document. */
95
- export interface DocumentLocationOutput {
96
- /** Path of document in storage. */
97
- path: string;
123
+ export interface DeidentificationDocumentLocationOutput {
124
+ /** Location of document in storage. */
125
+ location: string;
98
126
  /** The entity tag for this resource. */
99
127
  readonly etag: string;
100
128
  }
@@ -109,10 +137,6 @@ export interface DeidentificationResultOutput {
109
137
  export interface PhiTaggerResultOutput {
110
138
  /** List of entities detected in the input. */
111
139
  entities: Array<PhiEntityOutput>;
112
- /** Path to the document in storage. */
113
- path?: string;
114
- /** The entity tag for this resource. */
115
- etag?: string;
116
140
  }
117
141
  /** PHI Entity tag in the input. */
118
142
  export interface PhiEntityOutput {
@@ -148,16 +172,8 @@ export interface StringIndexOutput {
148
172
  */
149
173
  codePoint: number;
150
174
  }
151
- /** Alias for OperationTypeOutput */
152
- export type OperationTypeOutput = string;
153
- /** Alias for DocumentDataTypeOutput */
154
- export type DocumentDataTypeOutput = string;
155
- /** Alias for JobStatusOutput */
156
- export type JobStatusOutput = string;
157
- /** Paged collection of DeidentificationJob items */
158
- export type PagedDeidentificationJobOutput = Paged<DeidentificationJobOutput>;
159
- /** Paged collection of DocumentDetails items */
160
- export type PagedDocumentDetailsOutput = Paged<DocumentDetailsOutput>;
175
+ /** Alias for DeidentificationOperationTypeOutput */
176
+ export type DeidentificationOperationTypeOutput = string;
161
177
  /** Alias for OperationStateOutput */
162
178
  export type OperationStateOutput = string;
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C;IAC1B,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,mCAAmC;AACnC,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,oDAAoD;AACpD,MAAM,MAAM,mCAAmC,GAAG,MAAM,CAAC;AACzD,qCAAqC;AACrC,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC1C,kCAAkC;AAClC,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  //# 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\nimport { Paged } from \"@azure/core-paging\";\nimport { ErrorModel } from \"@azure-rest/core-client\";\n\n/** A job containing a batch of documents to de-identify. */\nexport interface DeidentificationJobOutput {\n /** The name of a job. */\n readonly name: string;\n /** Storage location to perform the operation on. */\n sourceLocation: SourceStorageLocationOutput;\n /** Target location to store output of operation. */\n targetLocation: TargetStorageLocationOutput;\n /**\n * Operation to perform on the input documents.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: OperationTypeOutput;\n /**\n * Data type of the input documents.\n *\n * Possible values: \"Plaintext\"\n */\n dataType?: DocumentDataTypeOutput;\n /** Format of the redacted output. Only valid when Operation is Redact. */\n redactionFormat?: string;\n /**\n * Current status of a job.\n *\n * Possible values: \"NotStarted\", \"Running\", \"Succeeded\", \"PartialFailed\", \"Failed\", \"Canceled\"\n */\n readonly status: JobStatusOutput;\n /** Error when job fails in it's entirety. */\n readonly error?: ErrorModel;\n /**\n * Date and time when the job was completed.\n *\n * If the job is canceled, this is the time when the job was canceled.\n *\n * If the job failed, this is the time when the job failed.\n */\n readonly lastUpdatedAt: string;\n /** Date and time when the job was created. */\n readonly createdAt: string;\n /** Date and time when the job was started. */\n readonly startedAt?: string;\n /** Summary of a job. Exists only when the job is completed. */\n readonly summary?: JobSummaryOutput;\n}\n\n/** Storage location. */\nexport interface SourceStorageLocationOutput {\n /** URL to storage location. */\n location: string;\n /** Prefix to filter path by. */\n prefix: string;\n /** List of extensions to filter path by. */\n extensions?: string[];\n}\n\n/** Storage location. */\nexport interface TargetStorageLocationOutput {\n /** URL to storage location. */\n location: string;\n /** Prefix to filter path by. */\n prefix: string;\n}\n\n/** Summary metrics of a job. */\nexport interface JobSummaryOutput {\n /** Number of documents that have completed. */\n successful: number;\n /** Number of documents that have failed. */\n failed: number;\n /** Number of documents that have been canceled. */\n canceled: number;\n /** Number of documents total. */\n total: number;\n /** Number of bytes processed. */\n bytesProcessed: number;\n}\n\n/** Details of a single document in a job. */\nexport interface DocumentDetailsOutput {\n /** Id of the document details. */\n readonly id: string;\n /** Location for the input. */\n input: DocumentLocationOutput;\n /** Location for the output. */\n output?: DocumentLocationOutput;\n /**\n * Status of the document.\n *\n * Possible values: \"NotStarted\", \"Running\", \"Succeeded\", \"Failed\", \"Canceled\"\n */\n status: OperationStateOutput;\n /** Error when document fails. */\n error?: ErrorModel;\n}\n\n/** Location of a document. */\nexport interface DocumentLocationOutput {\n /** Path of document in storage. */\n path: string;\n /** The entity tag for this resource. */\n readonly etag: string;\n}\n\n/** Response body for de-identification operation. */\nexport interface DeidentificationResultOutput {\n /** Output text after de-identification. Not available for \"Tag\" operation. */\n outputText?: string;\n /** Result of the \"Tag\" operation. Only available for \"Tag\" Operation. */\n taggerResult?: PhiTaggerResultOutput;\n}\n\n/** Result of the \"Tag\" operation. */\nexport interface PhiTaggerResultOutput {\n /** List of entities detected in the input. */\n entities: Array<PhiEntityOutput>;\n /** Path to the document in storage. */\n path?: string;\n /** The entity tag for this resource. */\n etag?: string;\n}\n\n/** PHI Entity tag in the input. */\nexport interface PhiEntityOutput {\n /**\n * PHI Category of the entity.\n *\n * Possible values: \"Unknown\", \"Account\", \"Age\", \"BioID\", \"City\", \"CountryOrRegion\", \"Date\", \"Device\", \"Doctor\", \"Email\", \"Fax\", \"HealthPlan\", \"Hospital\", \"IDNum\", \"IPAddress\", \"License\", \"LocationOther\", \"MedicalRecord\", \"Organization\", \"Patient\", \"Phone\", \"Profession\", \"SocialSecurity\", \"State\", \"Street\", \"Url\", \"Username\", \"Vehicle\", \"Zip\"\n */\n category: PhiCategoryOutput;\n /** Starting index of the location from within the input text. */\n offset: StringIndexOutput;\n /** Length of the input text. */\n length: StringIndexOutput;\n /** Text of the entity. */\n text?: string;\n /** Confidence score of the category match. */\n confidenceScore?: number;\n}\n\n/** String index encoding model. */\nexport interface StringIndexOutput {\n /** The offset or length of the substring in UTF-8 encoding */\n utf8: number;\n /**\n * The offset or length of the substring in UTF-16 encoding.\n *\n * Primary encoding used by .NET, Java, and JavaScript.\n */\n utf16: number;\n /**\n * The offset or length of the substring in CodePoint encoding.\n *\n * Primary encoding used by Python.\n */\n codePoint: number;\n}\n\n/** Alias for OperationTypeOutput */\nexport type OperationTypeOutput = string;\n/** Alias for DocumentDataTypeOutput */\nexport type DocumentDataTypeOutput = string;\n/** Alias for JobStatusOutput */\nexport type JobStatusOutput = string;\n/** Paged collection of DeidentificationJob items */\nexport type PagedDeidentificationJobOutput = Paged<DeidentificationJobOutput>;\n/** Paged collection of DocumentDetails items */\nexport type PagedDocumentDetailsOutput = Paged<DocumentDetailsOutput>;\n/** Alias for OperationStateOutput */\nexport type OperationStateOutput = string;\n/** Alias for PhiCategoryOutput */\nexport type PhiCategoryOutput = string;\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\nimport type { ErrorModel } from \"@azure-rest/core-client\";\n\n/** A job containing a batch of documents to de-identify. */\nexport interface DeidentificationJobOutput {\n /** The name of a job. */\n readonly name: string;\n /**\n * Operation to perform on the input documents.\n *\n * Possible values: \"Redact\", \"Surrogate\", \"Tag\"\n */\n operation?: DeidentificationOperationTypeOutput;\n /** Storage location to perform the operation on. */\n sourceLocation: SourceStorageLocationOutput;\n /** Target location to store output of operation. */\n targetLocation: TargetStorageLocationOutput;\n /** Customization parameters to override default service behaviors. */\n customizations?: DeidentificationJobCustomizationOptionsOutput;\n /**\n * Current status of a job.\n *\n * Possible values: \"NotStarted\", \"Running\", \"Succeeded\", \"Failed\", \"Canceled\"\n */\n readonly status: OperationStateOutput;\n /** Error when job fails in it's entirety. */\n readonly error?: ErrorModel;\n /**\n * Date and time when the job was completed.\n *\n * If the job is canceled, this is the time when the job was canceled.\n *\n * If the job failed, this is the time when the job failed.\n */\n readonly lastUpdatedAt: string;\n /** Date and time when the job was created. */\n readonly createdAt: string;\n /** Date and time when the job was started. */\n readonly startedAt?: string;\n /** Summary of a job. Exists only when the job is completed. */\n readonly summary?: DeidentificationJobSummaryOutput;\n}\n\n/** Storage location. */\nexport interface SourceStorageLocationOutput {\n /** URL to storage location. */\n location: string;\n /** Prefix to filter path by. */\n prefix: string;\n /** List of extensions to filter path by. */\n extensions?: string[];\n}\n\n/** Storage location. */\nexport interface TargetStorageLocationOutput {\n /** URL to storage location. */\n location: string;\n /**\n * Replaces the input prefix of a file path with the output prefix, preserving the rest of the path structure.\n *\n * Example:\n * File full path: documents/user/note.txt\n * Input Prefix: \"documents/user/\"\n * Output Prefix: \"output_docs/\"\n *\n * Output file: \"output_docs/note.txt\"\n */\n prefix: string;\n /** When set to true during a job, the service will overwrite the output location if it already exists. */\n overwrite?: boolean;\n}\n\n/** Customizations options to override default service behaviors for job usage. */\nexport interface DeidentificationJobCustomizationOptionsOutput {\n /**\n * Format of the redacted output. Only valid when Operation is Redact.\n * Please refer to https://learn.microsoft.com/en-us/azure/healthcare-apis/deidentification/redaction-format for more details.\n */\n redactionFormat?: string;\n /** Locale in which the output surrogates are written. */\n surrogateLocale?: string;\n}\n\n/** Summary metrics of a job. */\nexport interface DeidentificationJobSummaryOutput {\n /** Number of documents that have completed. */\n successful: number;\n /** Number of documents that have failed. */\n failed: number;\n /** Number of documents that have been canceled. */\n canceled: number;\n /** Number of documents total. */\n total: number;\n /** Number of bytes processed. */\n bytesProcessed: number;\n}\n\n/** Paged collection of DeidentificationJob items */\nexport interface PagedDeidentificationJobOutput {\n /** The DeidentificationJob items on this page */\n value: Array<DeidentificationJobOutput>;\n /** The link to the next page of items */\n nextLink?: string;\n}\n\n/** Paged collection of DeidentificationDocumentDetails items */\nexport interface PagedDeidentificationDocumentDetailsOutput {\n /** The DeidentificationDocumentDetails items on this page */\n value: Array<DeidentificationDocumentDetailsOutput>;\n /** The link to the next page of items */\n nextLink?: string;\n}\n\n/** Details of a single document in a job. */\nexport interface DeidentificationDocumentDetailsOutput {\n /** Id of the document details. */\n readonly id: string;\n /** Location for the input. */\n input: DeidentificationDocumentLocationOutput;\n /** Location for the output. */\n output?: DeidentificationDocumentLocationOutput;\n /**\n * Status of the document.\n *\n * Possible values: \"NotStarted\", \"Running\", \"Succeeded\", \"Failed\", \"Canceled\"\n */\n status: OperationStateOutput;\n /** Error when document fails. */\n error?: ErrorModel;\n}\n\n/** Location of a document. */\nexport interface DeidentificationDocumentLocationOutput {\n /** Location of document in storage. */\n location: string;\n /** The entity tag for this resource. */\n readonly etag: string;\n}\n\n/** Response body for de-identification operation. */\nexport interface DeidentificationResultOutput {\n /** Output text after de-identification. Not available for \"Tag\" operation. */\n outputText?: string;\n /** Result of the \"Tag\" operation. Only available for \"Tag\" Operation. */\n taggerResult?: PhiTaggerResultOutput;\n}\n\n/** Result of the \"Tag\" operation. */\nexport interface PhiTaggerResultOutput {\n /** List of entities detected in the input. */\n entities: Array<PhiEntityOutput>;\n}\n\n/** PHI Entity tag in the input. */\nexport interface PhiEntityOutput {\n /**\n * PHI Category of the entity.\n *\n * Possible values: \"Unknown\", \"Account\", \"Age\", \"BioID\", \"City\", \"CountryOrRegion\", \"Date\", \"Device\", \"Doctor\", \"Email\", \"Fax\", \"HealthPlan\", \"Hospital\", \"IDNum\", \"IPAddress\", \"License\", \"LocationOther\", \"MedicalRecord\", \"Organization\", \"Patient\", \"Phone\", \"Profession\", \"SocialSecurity\", \"State\", \"Street\", \"Url\", \"Username\", \"Vehicle\", \"Zip\"\n */\n category: PhiCategoryOutput;\n /** Starting index of the location from within the input text. */\n offset: StringIndexOutput;\n /** Length of the input text. */\n length: StringIndexOutput;\n /** Text of the entity. */\n text?: string;\n /** Confidence score of the category match. */\n confidenceScore?: number;\n}\n\n/** String index encoding model. */\nexport interface StringIndexOutput {\n /** The offset or length of the substring in UTF-8 encoding */\n utf8: number;\n /**\n * The offset or length of the substring in UTF-16 encoding.\n *\n * Primary encoding used by .NET, Java, and JavaScript.\n */\n utf16: number;\n /**\n * The offset or length of the substring in CodePoint encoding.\n *\n * Primary encoding used by Python.\n */\n codePoint: number;\n}\n\n/** Alias for DeidentificationOperationTypeOutput */\nexport type DeidentificationOperationTypeOutput = string;\n/** Alias for OperationStateOutput */\nexport type OperationStateOutput = string;\n/** Alias for PhiCategoryOutput */\nexport type PhiCategoryOutput = string;\n"]}
@@ -1,5 +1,30 @@
1
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
2
- import { Client, PathUncheckedResponse } from "@azure-rest/core-client";
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
+ }
3
28
  /**
4
29
  * Helper type to extract the type of an array
5
30
  */
@@ -7,7 +32,7 @@ export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
7
32
  /**
8
33
  * The type of a custom function that defines how to get a page and a link to the next one if any.
9
34
  */
10
- export type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{
35
+ export type GetPage<TPage> = (pageLink: string) => Promise<{
11
36
  page: TPage;
12
37
  nextPageLink?: string;
13
38
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"paginateHelper.d.ts","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,0BAA0B,EAAe,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,MAAM,EAAmB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEzF;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,KAAK,IAAI,CAC3B,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,KACjB,OAAO,CAAC;IACX,IAAI,EAAE,KAAK,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,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C;CACpE;AAyBD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IACzD,IAAI,EAAE,KAAK,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,SAAS;IACtC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CACtD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,CAAC,OAAO,IAAI,OAAO,SAAS;IACpD,IAAI,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC;CAC/B,GACG,YAAY,CAAC,KAAK,CAAC,GACnB,KAAK,CAAC,OAAO,CAAC,CAAC;AAEnB;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,SAAS,SAAS,qBAAqB,EAC9D,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,SAAS,EAC1B,OAAO,GAAE,aAAa,CAAC,SAAS,CAAM,GACrC,0BAA0B,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA0BvD"}
@@ -1,10 +1,107 @@
1
1
  "use strict";
2
2
  // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
3
+ // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.paginate = paginate;
6
- const core_paging_1 = require("@azure/core-paging");
6
+ const tslib_1 = require("tslib");
7
7
  const core_client_1 = require("@azure-rest/core-client");
8
+ /**
9
+ * returns an async iterator that iterates over results. It also has a `byPage`
10
+ * method that returns pages of items at once.
11
+ *
12
+ * @param pagedResult - an object that specifies how to get pages.
13
+ * @returns a paged async iterator that iterates over results.
14
+ */
15
+ function getPagedAsyncIterator(pagedResult) {
16
+ var _a;
17
+ const iter = getItemAsyncIterator(pagedResult);
18
+ return {
19
+ next() {
20
+ return iter.next();
21
+ },
22
+ [Symbol.asyncIterator]() {
23
+ return this;
24
+ },
25
+ byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => {
26
+ const { continuationToken } = settings !== null && settings !== void 0 ? settings : {};
27
+ return getPageAsyncIterator(pagedResult, {
28
+ pageLink: continuationToken,
29
+ });
30
+ }),
31
+ };
32
+ }
33
+ function getItemAsyncIterator(pagedResult) {
34
+ return tslib_1.__asyncGenerator(this, arguments, function* getItemAsyncIterator_1() {
35
+ var _a, e_1, _b, _c, _d, e_2, _e, _f;
36
+ const pages = getPageAsyncIterator(pagedResult);
37
+ const firstVal = yield tslib_1.__await(pages.next());
38
+ // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is
39
+ if (!Array.isArray(firstVal.value)) {
40
+ // can extract elements from this page
41
+ const { toElements } = pagedResult;
42
+ if (toElements) {
43
+ yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(toElements(firstVal.value))));
44
+ try {
45
+ for (var _g = true, pages_1 = tslib_1.__asyncValues(pages), pages_1_1; pages_1_1 = yield tslib_1.__await(pages_1.next()), _a = pages_1_1.done, !_a; _g = true) {
46
+ _c = pages_1_1.value;
47
+ _g = false;
48
+ const page = _c;
49
+ yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(toElements(page))));
50
+ }
51
+ }
52
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
53
+ finally {
54
+ try {
55
+ if (!_g && !_a && (_b = pages_1.return)) yield tslib_1.__await(_b.call(pages_1));
56
+ }
57
+ finally { if (e_1) throw e_1.error; }
58
+ }
59
+ }
60
+ else {
61
+ yield yield tslib_1.__await(firstVal.value);
62
+ // `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case
63
+ yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(pages)));
64
+ }
65
+ }
66
+ else {
67
+ yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(firstVal.value)));
68
+ try {
69
+ for (var _h = true, pages_2 = tslib_1.__asyncValues(pages), pages_2_1; pages_2_1 = yield tslib_1.__await(pages_2.next()), _d = pages_2_1.done, !_d; _h = true) {
70
+ _f = pages_2_1.value;
71
+ _h = false;
72
+ const page = _f;
73
+ // pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,
74
+ // it must be the case that `TPage = TElement[]`
75
+ yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(page)));
76
+ }
77
+ }
78
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
+ finally {
80
+ try {
81
+ if (!_h && !_d && (_e = pages_2.return)) yield tslib_1.__await(_e.call(pages_2));
82
+ }
83
+ finally { if (e_2) throw e_2.error; }
84
+ }
85
+ }
86
+ });
87
+ }
88
+ function getPageAsyncIterator(pagedResult_1) {
89
+ return tslib_1.__asyncGenerator(this, arguments, function* getPageAsyncIterator_1(pagedResult, options = {}) {
90
+ const { pageLink } = options;
91
+ let response = yield tslib_1.__await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink));
92
+ if (!response) {
93
+ return yield tslib_1.__await(void 0);
94
+ }
95
+ yield yield tslib_1.__await(response.page);
96
+ while (response.nextPageLink) {
97
+ response = yield tslib_1.__await(pagedResult.getPage(response.nextPageLink));
98
+ if (!response) {
99
+ return yield tslib_1.__await(void 0);
100
+ }
101
+ yield yield tslib_1.__await(response.page);
102
+ }
103
+ });
104
+ }
8
105
  /**
9
106
  * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
10
107
  * @param client - Client to use for sending the next page requests
@@ -33,7 +130,7 @@ function paginate(client, initialResponse, options = {}) {
33
130
  };
34
131
  },
35
132
  };
36
- return (0, core_paging_1.getPagedAsyncIterator)(pagedResult);
133
+ return getPagedAsyncIterator(pagedResult);
37
134
  }
38
135
  /**
39
136
  * Gets for the value of nextLink in the body
@@ -1 +1 @@
1
- {"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmDlC,4BA8BC;AA/ED,oDAAoG;AACpG,yDAAyF;AAyCzF;;;;;;GAMG;AACH,SAAgB,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,IAAA,mCAAqB,E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\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"]}
1
+ {"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA2LlC,4BA8BC;;AAtND,yDAA0D;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,CA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AAC;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,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,CAAC;QAClD,MAAM,IAAA,6BAAe,EACnB,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"]}