@azure-rest/health-deidentification 1.0.0-alpha.20250618.1 → 1.0.0-alpha.20250702.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 (114) hide show
  1. package/README.md +146 -26
  2. package/dist/browser/clientDefinitions.d.ts +6 -6
  3. package/dist/browser/clientDefinitions.d.ts.map +1 -1
  4. package/dist/browser/clientDefinitions.js.map +1 -1
  5. package/dist/browser/deidentificationClient.d.ts.map +1 -1
  6. package/dist/browser/deidentificationClient.js +2 -2
  7. package/dist/browser/deidentificationClient.js.map +1 -1
  8. package/dist/browser/isUnexpected.d.ts +3 -3
  9. package/dist/browser/isUnexpected.d.ts.map +1 -1
  10. package/dist/browser/isUnexpected.js.map +1 -1
  11. package/dist/browser/models.d.ts +45 -28
  12. package/dist/browser/models.d.ts.map +1 -1
  13. package/dist/browser/models.js.map +1 -1
  14. package/dist/browser/outputModels.d.ts +55 -39
  15. package/dist/browser/outputModels.d.ts.map +1 -1
  16. package/dist/browser/outputModels.js.map +1 -1
  17. package/dist/browser/paginateHelper.d.ts +27 -2
  18. package/dist/browser/paginateHelper.d.ts.map +1 -1
  19. package/dist/browser/paginateHelper.js +98 -1
  20. package/dist/browser/paginateHelper.js.map +1 -1
  21. package/dist/browser/parameters.d.ts +14 -7
  22. package/dist/browser/parameters.d.ts.map +1 -1
  23. package/dist/browser/parameters.js.map +1 -1
  24. package/dist/browser/pollingHelper.d.ts +2 -2
  25. package/dist/browser/pollingHelper.d.ts.map +1 -1
  26. package/dist/browser/pollingHelper.js.map +1 -1
  27. package/dist/browser/responses.d.ts +22 -17
  28. package/dist/browser/responses.d.ts.map +1 -1
  29. package/dist/browser/responses.js.map +1 -1
  30. package/dist/commonjs/clientDefinitions.d.ts +6 -6
  31. package/dist/commonjs/clientDefinitions.d.ts.map +1 -1
  32. package/dist/commonjs/clientDefinitions.js.map +1 -1
  33. package/dist/commonjs/deidentificationClient.d.ts.map +1 -1
  34. package/dist/commonjs/deidentificationClient.js +2 -2
  35. package/dist/commonjs/deidentificationClient.js.map +1 -1
  36. package/dist/commonjs/isUnexpected.d.ts +3 -3
  37. package/dist/commonjs/isUnexpected.d.ts.map +1 -1
  38. package/dist/commonjs/isUnexpected.js.map +1 -1
  39. package/dist/commonjs/models.d.ts +45 -28
  40. package/dist/commonjs/models.d.ts.map +1 -1
  41. package/dist/commonjs/models.js.map +1 -1
  42. package/dist/commonjs/outputModels.d.ts +55 -39
  43. package/dist/commonjs/outputModels.d.ts.map +1 -1
  44. package/dist/commonjs/outputModels.js.map +1 -1
  45. package/dist/commonjs/paginateHelper.d.ts +27 -2
  46. package/dist/commonjs/paginateHelper.d.ts.map +1 -1
  47. package/dist/commonjs/paginateHelper.js +99 -2
  48. package/dist/commonjs/paginateHelper.js.map +1 -1
  49. package/dist/commonjs/parameters.d.ts +14 -7
  50. package/dist/commonjs/parameters.d.ts.map +1 -1
  51. package/dist/commonjs/parameters.js.map +1 -1
  52. package/dist/commonjs/pollingHelper.d.ts +2 -2
  53. package/dist/commonjs/pollingHelper.d.ts.map +1 -1
  54. package/dist/commonjs/pollingHelper.js.map +1 -1
  55. package/dist/commonjs/responses.d.ts +22 -17
  56. package/dist/commonjs/responses.d.ts.map +1 -1
  57. package/dist/commonjs/responses.js.map +1 -1
  58. package/dist/esm/clientDefinitions.d.ts +6 -6
  59. package/dist/esm/clientDefinitions.d.ts.map +1 -1
  60. package/dist/esm/clientDefinitions.js.map +1 -1
  61. package/dist/esm/deidentificationClient.d.ts.map +1 -1
  62. package/dist/esm/deidentificationClient.js +2 -2
  63. package/dist/esm/deidentificationClient.js.map +1 -1
  64. package/dist/esm/isUnexpected.d.ts +3 -3
  65. package/dist/esm/isUnexpected.d.ts.map +1 -1
  66. package/dist/esm/isUnexpected.js.map +1 -1
  67. package/dist/esm/models.d.ts +45 -28
  68. package/dist/esm/models.d.ts.map +1 -1
  69. package/dist/esm/models.js.map +1 -1
  70. package/dist/esm/outputModels.d.ts +55 -39
  71. package/dist/esm/outputModels.d.ts.map +1 -1
  72. package/dist/esm/outputModels.js.map +1 -1
  73. package/dist/esm/paginateHelper.d.ts +27 -2
  74. package/dist/esm/paginateHelper.d.ts.map +1 -1
  75. package/dist/esm/paginateHelper.js +98 -1
  76. package/dist/esm/paginateHelper.js.map +1 -1
  77. package/dist/esm/parameters.d.ts +14 -7
  78. package/dist/esm/parameters.d.ts.map +1 -1
  79. package/dist/esm/parameters.js.map +1 -1
  80. package/dist/esm/pollingHelper.d.ts +2 -2
  81. package/dist/esm/pollingHelper.d.ts.map +1 -1
  82. package/dist/esm/pollingHelper.js.map +1 -1
  83. package/dist/esm/responses.d.ts +22 -17
  84. package/dist/esm/responses.d.ts.map +1 -1
  85. package/dist/esm/responses.js.map +1 -1
  86. package/dist/react-native/clientDefinitions.d.ts +6 -6
  87. package/dist/react-native/clientDefinitions.d.ts.map +1 -1
  88. package/dist/react-native/clientDefinitions.js.map +1 -1
  89. package/dist/react-native/deidentificationClient.d.ts.map +1 -1
  90. package/dist/react-native/deidentificationClient.js +2 -2
  91. package/dist/react-native/deidentificationClient.js.map +1 -1
  92. package/dist/react-native/isUnexpected.d.ts +3 -3
  93. package/dist/react-native/isUnexpected.d.ts.map +1 -1
  94. package/dist/react-native/isUnexpected.js.map +1 -1
  95. package/dist/react-native/models.d.ts +45 -28
  96. package/dist/react-native/models.d.ts.map +1 -1
  97. package/dist/react-native/models.js.map +1 -1
  98. package/dist/react-native/outputModels.d.ts +55 -39
  99. package/dist/react-native/outputModels.d.ts.map +1 -1
  100. package/dist/react-native/outputModels.js.map +1 -1
  101. package/dist/react-native/paginateHelper.d.ts +27 -2
  102. package/dist/react-native/paginateHelper.d.ts.map +1 -1
  103. package/dist/react-native/paginateHelper.js +98 -1
  104. package/dist/react-native/paginateHelper.js.map +1 -1
  105. package/dist/react-native/parameters.d.ts +14 -7
  106. package/dist/react-native/parameters.d.ts.map +1 -1
  107. package/dist/react-native/parameters.js.map +1 -1
  108. package/dist/react-native/pollingHelper.d.ts +2 -2
  109. package/dist/react-native/pollingHelper.d.ts.map +1 -1
  110. package/dist/react-native/pollingHelper.js.map +1 -1
  111. package/dist/react-native/responses.d.ts +22 -17
  112. package/dist/react-native/responses.d.ts.map +1 -1
  113. package/dist/react-native/responses.js.map +1 -1
  114. package/package.json +15 -8
@@ -1,33 +1,26 @@
1
- import type { Paged } from "@azure/core-paging";
2
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;
163
179
  /** Alias for PhiCategoryOutput */
@@ -1 +1 @@
1
- {"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,cAAc,EAAE,2BAA2B,CAAC;IAC5C,oDAAoD;IACpD,cAAc,EAAE,2BAA2B,CAAC;IAC5C;;;;OAIG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,wBAAwB;AACxB,MAAM,WAAW,2BAA2B;IAC1C,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,UAAU,CAAC,EAAE,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AiB,CAAC;IAC5B,iEAAiE;IACjE,MAAM,EAAE,iBAAiB,CAAC;IAC1B,gCAAgC;IAChC,MAAM,EAAE,iBAAiB,CAAC;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 +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 type { Paged } from \"@azure/core-paging\";\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 /** 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 type { PagedAsyncIterableIterator } from "@azure/core-paging";
2
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,KAAK,EAAE,0BAA0B,EAAe,MAAM,oBAAoB,CAAC;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAG7E;;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,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,SAAS;IACtC;;OAEG;IACH,aAAa,CA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,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"}
@@ -3,8 +3,105 @@
3
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 n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AAC;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,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 { PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { getPagedAsyncIterator } from \"@azure/core-paging\";\nimport type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } 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,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EACJ,MAAA,WAAW,aAAX,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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"]}
@@ -9,18 +9,18 @@ export interface GetJobHeaderParam {
9
9
  headers?: RawHttpHeadersInput & GetJobHeaders;
10
10
  }
11
11
  export type GetJobParameters = GetJobHeaderParam & RequestParameters;
12
- export interface CreateJobHeaders {
12
+ export interface DeidentifyDocumentsHeaders {
13
13
  /** An opaque, globally-unique, client-generated string identifier for the request. */
14
14
  "x-ms-client-request-id"?: string;
15
15
  }
16
- export interface CreateJobBodyParam {
16
+ export interface DeidentifyDocumentsBodyParam {
17
17
  /** The resource instance. */
18
18
  body: DeidentificationJob;
19
19
  }
20
- export interface CreateJobHeaderParam {
21
- headers?: RawHttpHeadersInput & CreateJobHeaders;
20
+ export interface DeidentifyDocumentsHeaderParam {
21
+ headers?: RawHttpHeadersInput & DeidentifyDocumentsHeaders;
22
22
  }
23
- export type CreateJobParameters = CreateJobHeaderParam & CreateJobBodyParam & RequestParameters;
23
+ export type DeidentifyDocumentsParameters = DeidentifyDocumentsHeaderParam & DeidentifyDocumentsBodyParam & RequestParameters;
24
24
  export interface ListJobsHeaders {
25
25
  /** An opaque, globally-unique, client-generated string identifier for the request. */
26
26
  "x-ms-client-request-id"?: string;
@@ -71,9 +71,16 @@ export interface DeleteJobHeaderParam {
71
71
  headers?: RawHttpHeadersInput & DeleteJobHeaders;
72
72
  }
73
73
  export type DeleteJobParameters = DeleteJobHeaderParam & RequestParameters;
74
- export interface DeidentifyBodyParam {
74
+ export interface DeidentifyTextHeaders {
75
+ /** An opaque, globally-unique, client-generated string identifier for the request. */
76
+ "x-ms-client-request-id"?: string;
77
+ }
78
+ export interface DeidentifyTextBodyParam {
75
79
  /** Request body for de-identification operation. */
76
80
  body: DeidentificationContent;
77
81
  }
78
- export type DeidentifyParameters = DeidentifyBodyParam & RequestParameters;
82
+ export interface DeidentifyTextHeaderParam {
83
+ headers?: RawHttpHeadersInput & DeidentifyTextHeaders;
84
+ }
85
+ export type DeidentifyTextParameters = DeidentifyTextHeaderParam & DeidentifyTextBodyParam & RequestParameters;
79
86
  //# sourceMappingURL=parameters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.d.ts","sourceRoot":"","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CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,0BAA0B;IACzC,eAAe,CAAC,EAAE,oCAAoC,CAAC;CACxD;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,mBAAmB,GAAG,uBAAuB,CAAC;CACzD;AAED,MAAM,MAAM,0BAA0B,GAAG,0BAA0B,GACjE,2BAA2B,GAC3B,iBAAiB,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,sFAAsF;IACtF,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,CAAC;CAClD;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,iBAAiB,CAAC;AAE3E,MAAM,WAAW,gBAAgB;IAC/B,sFAAsF;IACtF,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,CAAC;CAClD;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,iBAAiB,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IACpC,sFAAsF;IACtF,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC,oDAAoD;IACpD,IAAI,EAAE,uBAAuB,CAAC;CAC/B;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,mBAAmB,GAAG,qBAAqB,CAAC;CACvD;AAED,MAAM,MAAM,wBAAwB,GAAG,yBAAyB,GAC9D,uBAAuB,GACvB,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type { DeidentificationJob, DeidentificationContent } from \"./models.js\";\n\nexport interface GetJobHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface GetJobHeaderParam {\n headers?: RawHttpHeadersInput & GetJobHeaders;\n}\n\nexport type GetJobParameters = GetJobHeaderParam & RequestParameters;\n\nexport interface CreateJobHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface CreateJobBodyParam {\n /** The resource instance. */\n body: DeidentificationJob;\n}\n\nexport interface CreateJobHeaderParam {\n headers?: RawHttpHeadersInput & CreateJobHeaders;\n}\n\nexport type CreateJobParameters = CreateJobHeaderParam & CreateJobBodyParam & RequestParameters;\n\nexport interface ListJobsHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface ListJobsQueryParamProperties {\n /** The maximum number of result items per page. */\n maxpagesize?: number;\n /** Token to continue a previous query. */\n continuationToken?: string;\n}\n\nexport interface ListJobsQueryParam {\n queryParameters?: ListJobsQueryParamProperties;\n}\n\nexport interface ListJobsHeaderParam {\n headers?: RawHttpHeadersInput & ListJobsHeaders;\n}\n\nexport type ListJobsParameters = ListJobsQueryParam & ListJobsHeaderParam & RequestParameters;\n\nexport interface ListJobDocumentsHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface ListJobDocumentsQueryParamProperties {\n /** The maximum number of result items per page. */\n maxpagesize?: number;\n /** Token to continue a previous query. */\n continuationToken?: string;\n}\n\nexport interface ListJobDocumentsQueryParam {\n queryParameters?: ListJobDocumentsQueryParamProperties;\n}\n\nexport interface ListJobDocumentsHeaderParam {\n headers?: RawHttpHeadersInput & ListJobDocumentsHeaders;\n}\n\nexport type ListJobDocumentsParameters = ListJobDocumentsQueryParam &\n ListJobDocumentsHeaderParam &\n RequestParameters;\n\nexport interface CancelJobHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface CancelJobHeaderParam {\n headers?: RawHttpHeadersInput & CancelJobHeaders;\n}\n\nexport type CancelJobParameters = CancelJobHeaderParam & RequestParameters;\n\nexport interface DeleteJobHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface DeleteJobHeaderParam {\n headers?: RawHttpHeadersInput & DeleteJobHeaders;\n}\n\nexport type DeleteJobParameters = DeleteJobHeaderParam & RequestParameters;\n\nexport interface DeidentifyBodyParam {\n /** Request body for de-identification operation. */\n body: DeidentificationContent;\n}\n\nexport type DeidentifyParameters = DeidentifyBodyParam & RequestParameters;\n"]}
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type { DeidentificationJob, DeidentificationContent } from \"./models.js\";\n\nexport interface GetJobHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface GetJobHeaderParam {\n headers?: RawHttpHeadersInput & GetJobHeaders;\n}\n\nexport type GetJobParameters = GetJobHeaderParam & RequestParameters;\n\nexport interface DeidentifyDocumentsHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface DeidentifyDocumentsBodyParam {\n /** The resource instance. */\n body: DeidentificationJob;\n}\n\nexport interface DeidentifyDocumentsHeaderParam {\n headers?: RawHttpHeadersInput & DeidentifyDocumentsHeaders;\n}\n\nexport type DeidentifyDocumentsParameters = DeidentifyDocumentsHeaderParam &\n DeidentifyDocumentsBodyParam &\n RequestParameters;\n\nexport interface ListJobsHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface ListJobsQueryParamProperties {\n /** The maximum number of result items per page. */\n maxpagesize?: number;\n /** Token to continue a previous query. */\n continuationToken?: string;\n}\n\nexport interface ListJobsQueryParam {\n queryParameters?: ListJobsQueryParamProperties;\n}\n\nexport interface ListJobsHeaderParam {\n headers?: RawHttpHeadersInput & ListJobsHeaders;\n}\n\nexport type ListJobsParameters = ListJobsQueryParam & ListJobsHeaderParam & RequestParameters;\n\nexport interface ListJobDocumentsHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface ListJobDocumentsQueryParamProperties {\n /** The maximum number of result items per page. */\n maxpagesize?: number;\n /** Token to continue a previous query. */\n continuationToken?: string;\n}\n\nexport interface ListJobDocumentsQueryParam {\n queryParameters?: ListJobDocumentsQueryParamProperties;\n}\n\nexport interface ListJobDocumentsHeaderParam {\n headers?: RawHttpHeadersInput & ListJobDocumentsHeaders;\n}\n\nexport type ListJobDocumentsParameters = ListJobDocumentsQueryParam &\n ListJobDocumentsHeaderParam &\n RequestParameters;\n\nexport interface CancelJobHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface CancelJobHeaderParam {\n headers?: RawHttpHeadersInput & CancelJobHeaders;\n}\n\nexport type CancelJobParameters = CancelJobHeaderParam & RequestParameters;\n\nexport interface DeleteJobHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface DeleteJobHeaderParam {\n headers?: RawHttpHeadersInput & DeleteJobHeaders;\n}\n\nexport type DeleteJobParameters = DeleteJobHeaderParam & RequestParameters;\n\nexport interface DeidentifyTextHeaders {\n /** An opaque, globally-unique, client-generated string identifier for the request. */\n \"x-ms-client-request-id\"?: string;\n}\n\nexport interface DeidentifyTextBodyParam {\n /** Request body for de-identification operation. */\n body: DeidentificationContent;\n}\n\nexport interface DeidentifyTextHeaderParam {\n headers?: RawHttpHeadersInput & DeidentifyTextHeaders;\n}\n\nexport type DeidentifyTextParameters = DeidentifyTextHeaderParam &\n DeidentifyTextBodyParam &\n RequestParameters;\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { Client } from "@azure-rest/core-client";
2
2
  import type { AbortSignalLike } from "@azure/abort-controller";
3
3
  import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro";
4
- import type { CreateJob200Response, CreateJob201Response, CreateJobDefaultResponse, CreateJobLogicalResponse } from "./responses.js";
4
+ import type { DeidentifyDocuments200Response, DeidentifyDocuments201Response, DeidentifyDocumentsDefaultResponse, DeidentifyDocumentsLogicalResponse } from "./responses.js";
5
5
  /**
6
6
  * A simple poller that can be used to poll a long running operation.
7
7
  */
@@ -73,5 +73,5 @@ export interface SimplePollerLike<TState extends OperationState<TResult>, TResul
73
73
  * @param options - Options to set a resume state or custom polling interval.
74
74
  * @returns - A poller object to poll for operation state updates and eventually get the final response.
75
75
  */
76
- export declare function getLongRunningPoller<TResult extends CreateJobLogicalResponse | CreateJobDefaultResponse>(client: Client, initialResponse: CreateJob200Response | CreateJob201Response | CreateJobDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
76
+ export declare function getLongRunningPoller<TResult extends DeidentifyDocumentsLogicalResponse | DeidentifyDocumentsDefaultResponse>(client: Client, initialResponse: DeidentifyDocuments200Response | DeidentifyDocuments201Response | DeidentifyDocumentsDefaultResponse, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
77
77
  //# sourceMappingURL=pollingHelper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Q,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,GACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type {\n CancelOnProgress,\n CreateHttpPollerOptions,\n RunningOperation,\n OperationResponse,\n OperationState,\n} from \"@azure/core-lro\";\nimport { createHttpPoller } from \"@azure/core-lro\";\nimport type {\n CreateJob200Response,\n CreateJob201Response,\n CreateJobDefaultResponse,\n CreateJobLogicalResponse,\n} from \"./responses.js\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n\n /**\n * Returns true if the poller is stopped.\n * @deprecated Use abortSignal status to track this instead.\n */\n isStopped(): boolean;\n}\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<\n TResult extends CreateJobLogicalResponse | CreateJobDefaultResponse,\n>(\n client: Client,\n initialResponse: CreateJob200Response | CreateJob201Response | CreateJobDefaultResponse,\n options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: RunningOperation<TResult> = {\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path: string, pollOptions?: { abortSignal?: AbortSignalLike }) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = pollOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return abortController.signal.aborted;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}
1
+ {"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAsGlC,oDAoFC;AA/KD,8CAAmD;AA2F5C,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,eAAwB,EACxB,UAAqE,EAAE;;IAEvE,MAAM,eAAe,GAAG,IAAI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QAAiB;IAEjB,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,SAAS,CAAC,uDAAuD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,WAAW,kCACN,QAAQ,KACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,GACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type {\n CancelOnProgress,\n CreateHttpPollerOptions,\n RunningOperation,\n OperationResponse,\n OperationState,\n} from \"@azure/core-lro\";\nimport { createHttpPoller } from \"@azure/core-lro\";\nimport type {\n DeidentifyDocuments200Response,\n DeidentifyDocuments201Response,\n DeidentifyDocumentsDefaultResponse,\n DeidentifyDocumentsLogicalResponse,\n} from \"./responses.js\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n\n /**\n * Returns true if the poller is stopped.\n * @deprecated Use abortSignal status to track this instead.\n */\n isStopped(): boolean;\n}\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<\n TResult extends DeidentifyDocumentsLogicalResponse | DeidentifyDocumentsDefaultResponse,\n>(\n client: Client,\n initialResponse:\n | DeidentifyDocuments200Response\n | DeidentifyDocuments201Response\n | DeidentifyDocumentsDefaultResponse,\n options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: RunningOperation<TResult> = {\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path: string, pollOptions?: { abortSignal?: AbortSignalLike }) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = pollOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return abortController.signal.aborted;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}