azure-mock 2.38.1 → 2.40.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.
- package/LICENSE +201 -201
- package/dist/index.d.ts +97 -68
- package/dist/index.js +98 -53
- package/package.json +12 -13
package/LICENSE
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2020-present Jimmy Chen
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2020-present Jimmy Chen
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/dist/index.d.ts
CHANGED
|
@@ -9,15 +9,15 @@ import { CreateTableEntityResponse, GetAccessPolicyResponse, GetTableEntityRespo
|
|
|
9
9
|
import { QueueClearMessagesResponse, QueueClient, QueueCreateIfNotExistsResponse, QueueCreateOptions, QueueCreateResponse, QueueDeleteIfExistsResponse, QueueDeleteMessageResponse, QueueDeleteResponse, QueueGenerateSasUrlOptions, QueueGetAccessPolicyResponse, QueueGetPropertiesResponse, QueueItem, QueuePeekMessagesOptions, QueuePeekMessagesResponse, QueueReceiveMessageOptions, QueueReceiveMessageResponse, QueueSendMessageOptions, QueueSendMessageResponse, QueueServiceProperties, QueueSetAccessPolicyResponse, QueueSetMetadataResponse, QueueUpdateMessageResponse, SignedIdentifier } from "@azure/storage-queue";
|
|
10
10
|
import { AutocompleteResult, CountDocumentsOptions, DeleteDocumentsOptions, GetDocumentOptions, IndexDocumentsBatch, IndexDocumentsOptions, IndexDocumentsResult, MergeDocumentsOptions, MergeOrUploadDocumentsOptions, NarrowedModel, SearchClient, SearchDocumentsResult, SearchOptions, SelectFields, SuggestDocumentsResult, SuggestOptions, UploadDocumentsOptions } from "@azure/search-documents";
|
|
11
11
|
//#region src/constants.d.ts
|
|
12
|
-
declare const BLOB_NOT_FOUND_ERROR_CODE = "BlobNotFound";
|
|
13
|
-
declare const BLOB_NOT_FOUND_MESSAGE = "The specified blob does not exist.";
|
|
14
|
-
declare const MOCK_BLOB_BASE_URL = "https://mockaccount.blob.core.windows.net";
|
|
15
|
-
declare const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
|
|
16
|
-
declare const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
|
|
17
|
-
declare const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
|
|
12
|
+
export declare const BLOB_NOT_FOUND_ERROR_CODE = "BlobNotFound";
|
|
13
|
+
export declare const BLOB_NOT_FOUND_MESSAGE = "The specified blob does not exist.";
|
|
14
|
+
export declare const MOCK_BLOB_BASE_URL = "https://mockaccount.blob.core.windows.net";
|
|
15
|
+
export declare const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
|
|
16
|
+
export declare const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
|
|
17
|
+
export declare const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/models/MockResponse.d.ts
|
|
20
|
-
interface MockResponse {
|
|
20
|
+
export interface MockResponse {
|
|
21
21
|
headers: HttpHeadersLike;
|
|
22
22
|
parsedHeaders: Record<string, never>;
|
|
23
23
|
request: WebResourceLike;
|
|
@@ -25,7 +25,7 @@ interface MockResponse {
|
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/models/MockRestError.d.ts
|
|
28
|
-
declare class MockRestError extends RestError {
|
|
28
|
+
export declare class MockRestError extends RestError {
|
|
29
29
|
constructor(message: string, statusCode: number);
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
@@ -33,7 +33,7 @@ declare class MockRestError extends RestError {
|
|
|
33
33
|
/**
|
|
34
34
|
* An interface that tracks the settings for paged iteration
|
|
35
35
|
*/
|
|
36
|
-
interface PageSettings {
|
|
36
|
+
export interface PageSettings {
|
|
37
37
|
/**
|
|
38
38
|
* The token that keeps track of where to continue the iterator
|
|
39
39
|
*/
|
|
@@ -48,7 +48,7 @@ interface PageSettings {
|
|
|
48
48
|
/**
|
|
49
49
|
* An interface that allows async iterable iteration both to completion and by page.
|
|
50
50
|
*/
|
|
51
|
-
interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
|
|
51
|
+
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
|
|
52
52
|
/**
|
|
53
53
|
* The connection to the async iterator, part of the iteration protocol
|
|
54
54
|
*/
|
|
@@ -64,45 +64,53 @@ interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings
|
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/services/createMockResponse.d.ts
|
|
67
|
-
declare const createMockResponse: (status: number, url?: string) => MockResponse;
|
|
67
|
+
export declare const createMockResponse: (status: number, url?: string) => MockResponse;
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region src/services/getMockSasUrl.d.ts
|
|
70
|
-
declare const getMockSasUrl: (url: string, permissions: undefined | {
|
|
70
|
+
export declare const getMockSasUrl: (url: string, permissions: undefined | {
|
|
71
71
|
toString: () => string;
|
|
72
72
|
}, resourceType?: string) => string;
|
|
73
73
|
//#endregion
|
|
74
|
-
//#region src/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
//#region src/models/container/MockBlobDates.d.ts
|
|
75
|
+
export interface MockBlobDates {
|
|
76
|
+
createdOn: Date;
|
|
77
|
+
etag: string;
|
|
78
|
+
lastModified: Date;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/store/MockContainerBlobDatesDatabase.d.ts
|
|
82
|
+
export declare const MockContainerBlobDatesDatabase: Map<string, MockBlobDates>;
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/store/MockContainerBlobMetadataDatabase.d.ts
|
|
85
|
+
export declare const MockContainerBlobMetadataDatabase: Map<string, Record<string, string>>;
|
|
78
86
|
//#endregion
|
|
79
87
|
//#region src/store/MockContainerDatabase.d.ts
|
|
80
|
-
declare const MockContainerDatabase: Map<string, Map<string, Buffer>>;
|
|
88
|
+
export declare const MockContainerDatabase: Map<string, Map<string, Buffer>>;
|
|
81
89
|
//#endregion
|
|
82
90
|
//#region src/store/MockEventGridDatabase.d.ts
|
|
83
|
-
declare const MockEventGridDatabase: Map<string, EventGridEvent<unknown>[]>;
|
|
91
|
+
export declare const MockEventGridDatabase: Map<string, EventGridEvent<unknown>[]>;
|
|
84
92
|
//#endregion
|
|
85
93
|
//#region src/store/MockQueueDatabase.d.ts
|
|
86
|
-
declare const MockQueueDatabase: Map<string, string[]>;
|
|
94
|
+
export declare const MockQueueDatabase: Map<string, string[]>;
|
|
87
95
|
//#endregion
|
|
88
96
|
//#region src/store/MockSearchDatabase.d.ts
|
|
89
|
-
declare const MockSearchDatabase: Map<string, object[]>;
|
|
97
|
+
export declare const MockSearchDatabase: Map<string, object[]>;
|
|
90
98
|
//#endregion
|
|
91
99
|
//#region src/store/MockServiceBusDatabase.d.ts
|
|
92
|
-
declare const MockServiceBusDatabase: Map<string, ServiceBusMessage[]>;
|
|
100
|
+
export declare const MockServiceBusDatabase: Map<string, ServiceBusMessage[]>;
|
|
93
101
|
//#endregion
|
|
94
102
|
//#region src/store/MockTableDatabase.d.ts
|
|
95
|
-
declare const MockTableDatabase: Map<string, Map<string, TableEntity>>;
|
|
103
|
+
export declare const MockTableDatabase: Map<string, Map<string, TableEntity>>;
|
|
96
104
|
//#endregion
|
|
97
105
|
//#region src/models/container/BlobHierarchyItem.d.ts
|
|
98
|
-
type BlobHierarchyItem = (BlobItem & {
|
|
106
|
+
export type BlobHierarchyItem = (BlobItem & {
|
|
99
107
|
kind: "blob";
|
|
100
108
|
}) | (BlobPrefix & {
|
|
101
109
|
kind: "prefix";
|
|
102
110
|
});
|
|
103
111
|
//#endregion
|
|
104
112
|
//#region src/models/container/MockBlobBatchClient.d.ts
|
|
105
|
-
declare class MockBlobBatchClient implements BlobBatchClient {
|
|
113
|
+
export declare class MockBlobBatchClient implements BlobBatchClient {
|
|
106
114
|
#private;
|
|
107
115
|
url: string;
|
|
108
116
|
constructor(url: string);
|
|
@@ -116,7 +124,7 @@ declare class MockBlobBatchClient implements BlobBatchClient {
|
|
|
116
124
|
getContainer(containerName: string): MapValue<typeof MockContainerDatabase>;
|
|
117
125
|
}
|
|
118
126
|
//#endregion
|
|
119
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
127
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-any.d.ts
|
|
120
128
|
/**
|
|
121
129
|
Returns a boolean for whether the given type is `any`.
|
|
122
130
|
|
|
@@ -147,7 +155,7 @@ const anyA = get(anyObject, 'a');
|
|
|
147
155
|
*/
|
|
148
156
|
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
149
157
|
//#endregion
|
|
150
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
158
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
151
159
|
/**
|
|
152
160
|
Returns a boolean for whether the given key is an optional key of type.
|
|
153
161
|
|
|
@@ -190,7 +198,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
190
198
|
*/
|
|
191
199
|
type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
|
|
192
200
|
//#endregion
|
|
193
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
201
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
194
202
|
/**
|
|
195
203
|
Extract all optional keys from the given type.
|
|
196
204
|
|
|
@@ -228,7 +236,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
|
|
|
228
236
|
? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never; }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
|
|
229
237
|
: never; // Should never happen
|
|
230
238
|
//#endregion
|
|
231
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
239
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
232
240
|
/**
|
|
233
241
|
Extract all required keys from the given type.
|
|
234
242
|
|
|
@@ -262,7 +270,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
|
262
270
|
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
263
271
|
? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
|
|
264
272
|
//#endregion
|
|
265
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
273
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-never.d.ts
|
|
266
274
|
/**
|
|
267
275
|
Returns a boolean for whether the given type is `never`.
|
|
268
276
|
|
|
@@ -318,7 +326,7 @@ type B = IsTrueFixed<never>;
|
|
|
318
326
|
*/
|
|
319
327
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
320
328
|
//#endregion
|
|
321
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
329
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/if.d.ts
|
|
322
330
|
/**
|
|
323
331
|
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
324
332
|
|
|
@@ -413,7 +421,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
|
413
421
|
*/
|
|
414
422
|
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
415
423
|
//#endregion
|
|
416
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
424
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/simplify.d.ts
|
|
417
425
|
/**
|
|
418
426
|
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
419
427
|
|
|
@@ -474,7 +482,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
474
482
|
*/
|
|
475
483
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
|
|
476
484
|
//#endregion
|
|
477
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
485
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-equal.d.ts
|
|
478
486
|
/**
|
|
479
487
|
Returns a boolean for whether the two given types are equal.
|
|
480
488
|
|
|
@@ -505,7 +513,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
|
|
|
505
513
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
506
514
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
507
515
|
//#endregion
|
|
508
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
516
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
509
517
|
/**
|
|
510
518
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
511
519
|
|
|
@@ -599,7 +607,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
599
607
|
*/
|
|
600
608
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
|
|
601
609
|
//#endregion
|
|
602
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
610
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
603
611
|
/**
|
|
604
612
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
605
613
|
|
|
@@ -647,7 +655,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
647
655
|
*/
|
|
648
656
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
|
|
649
657
|
//#endregion
|
|
650
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
658
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/merge.d.ts
|
|
651
659
|
// Merges two objects without worrying about index signatures.
|
|
652
660
|
type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
|
|
653
661
|
/**
|
|
@@ -718,7 +726,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
|
|
|
718
726
|
: never; // Should never happen
|
|
719
727
|
type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
720
728
|
//#endregion
|
|
721
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
729
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/internal/object.d.ts
|
|
722
730
|
/**
|
|
723
731
|
Merges user specified options with default options.
|
|
724
732
|
|
|
@@ -775,7 +783,7 @@ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<
|
|
|
775
783
|
) ? Result : never;
|
|
776
784
|
type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key]; }>>>;
|
|
777
785
|
//#endregion
|
|
778
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
786
|
+
//#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/except.d.ts
|
|
779
787
|
/**
|
|
780
788
|
Filter out keys from an object.
|
|
781
789
|
|
|
@@ -876,7 +884,7 @@ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends Excep
|
|
|
876
884
|
type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
|
|
877
885
|
//#endregion
|
|
878
886
|
//#region src/models/container/MockBlobClient.d.ts
|
|
879
|
-
declare class MockBlobClient implements Except<BlobClient, "accountName"> {
|
|
887
|
+
export declare class MockBlobClient implements Except<BlobClient, "accountName"> {
|
|
880
888
|
connectionString: string;
|
|
881
889
|
containerName: string;
|
|
882
890
|
credential: AnonymousCredential;
|
|
@@ -918,7 +926,7 @@ declare class MockBlobClient implements Except<BlobClient, "accountName"> {
|
|
|
918
926
|
}
|
|
919
927
|
//#endregion
|
|
920
928
|
//#region src/models/container/MockBlockBlobClient.d.ts
|
|
921
|
-
declare class MockBlockBlobClient extends MockBlobClient implements Except<BlockBlobClient, "accountName"> {
|
|
929
|
+
export declare class MockBlockBlobClient extends MockBlobClient implements Except<BlockBlobClient, "accountName"> {
|
|
922
930
|
commitBlockList(): Promise<BlockBlobCommitBlockListResponse>;
|
|
923
931
|
getBlockList(): Promise<BlockBlobGetBlockListResponse>;
|
|
924
932
|
query(): Promise<BlobDownloadResponseModel>;
|
|
@@ -942,7 +950,7 @@ declare class MockBlockBlobClient extends MockBlobClient implements Except<Block
|
|
|
942
950
|
* await blockBlobClient.upload("hello world", 11);
|
|
943
951
|
* const content = await blockBlobClient.downloadToBuffer();
|
|
944
952
|
*/
|
|
945
|
-
declare class MockContainerClient implements Except<ContainerClient, "accountName"> {
|
|
953
|
+
export declare class MockContainerClient implements Except<ContainerClient, "accountName"> {
|
|
946
954
|
#private;
|
|
947
955
|
connectionString: string;
|
|
948
956
|
containerName: string;
|
|
@@ -985,7 +993,7 @@ declare class MockContainerClient implements Except<ContainerClient, "accountNam
|
|
|
985
993
|
* An in-memory mock of the Azure EventGridPublisherClient — no emulator and no network.
|
|
986
994
|
* `client` is excluded because it is a private member of the real class and cannot be satisfied structurally.
|
|
987
995
|
*/
|
|
988
|
-
declare class MockEventGridPublisherClient implements Except<EventGridPublisherClient<"EventGrid">, "apiVersion"> {
|
|
996
|
+
export declare class MockEventGridPublisherClient implements Except<EventGridPublisherClient<"EventGrid">, "apiVersion"> {
|
|
989
997
|
readonly endpointUrl: string;
|
|
990
998
|
readonly inputSchema: "EventGrid";
|
|
991
999
|
readonly topicType: "EventGrid";
|
|
@@ -1003,7 +1011,7 @@ declare class MockEventGridPublisherClient implements Except<EventGridPublisherC
|
|
|
1003
1011
|
* await mockQueueClient.sendMessage("hello world");
|
|
1004
1012
|
* const messages = await mockQueueClient.peekMessages();
|
|
1005
1013
|
*/
|
|
1006
|
-
declare class MockQueueClient implements Except<QueueClient, "accountName"> {
|
|
1014
|
+
export declare class MockQueueClient implements Except<QueueClient, "accountName"> {
|
|
1007
1015
|
connectionString: string;
|
|
1008
1016
|
name: string;
|
|
1009
1017
|
url: string;
|
|
@@ -1042,7 +1050,7 @@ declare class MockQueueClient implements Except<QueueClient, "accountName"> {
|
|
|
1042
1050
|
* await mockSearchClient.uploadDocuments([{ ... }]);
|
|
1043
1051
|
* const { count, results } = await mockSearchClient.search("*", { filter, includeTotalCount: true });
|
|
1044
1052
|
*/
|
|
1045
|
-
declare class MockSearchClient<TModel extends object = Record<string, unknown>> implements Except<SearchClient<TModel>, "pipeline"> {
|
|
1053
|
+
export declare class MockSearchClient<TModel extends object = Record<string, unknown>> implements Except<SearchClient<TModel>, "pipeline"> {
|
|
1046
1054
|
readonly apiVersion: string;
|
|
1047
1055
|
readonly endpoint: string;
|
|
1048
1056
|
readonly indexName: string;
|
|
@@ -1070,7 +1078,7 @@ declare class MockSearchClient<TModel extends object = Record<string, unknown>>
|
|
|
1070
1078
|
* const mockServiceBusSender = new MockServiceBusSender("hello world");
|
|
1071
1079
|
* await mockServiceBusSender.scheduleMessages({ body: "hello world" }, new Date());
|
|
1072
1080
|
*/
|
|
1073
|
-
declare class MockServiceBusSender implements ServiceBusSender {
|
|
1081
|
+
export declare class MockServiceBusSender implements ServiceBusSender {
|
|
1074
1082
|
entityPath: string;
|
|
1075
1083
|
identifier: string;
|
|
1076
1084
|
isClosed: boolean;
|
|
@@ -1092,7 +1100,7 @@ declare class MockServiceBusSender implements ServiceBusSender {
|
|
|
1092
1100
|
* await mockTableClient.createEntity({ partitionKey: "partitionKey", rowKey: "rowKey" });
|
|
1093
1101
|
* const entity = await mockTableClient.getEntity("partitionKey", "rowKey");
|
|
1094
1102
|
*/
|
|
1095
|
-
declare class MockTableClient<TEntity extends TableEntity = TableEntity> implements Except<TableClient, "pipeline"> {
|
|
1103
|
+
export declare class MockTableClient<TEntity extends TableEntity = TableEntity> implements Except<TableClient, "pipeline"> {
|
|
1096
1104
|
#private;
|
|
1097
1105
|
entityType: TEntity;
|
|
1098
1106
|
tableName: string;
|
|
@@ -1119,14 +1127,24 @@ declare class MockTableClient<TEntity extends TableEntity = TableEntity> impleme
|
|
|
1119
1127
|
* A minimal mock of the Azure WebPubSubServiceClient for testing purposes.
|
|
1120
1128
|
* Only implements `group().sendToAll` — the only method used in azure-functions tests.
|
|
1121
1129
|
*/
|
|
1122
|
-
declare class MockWebPubSubServiceClient {
|
|
1130
|
+
export declare class MockWebPubSubServiceClient {
|
|
1123
1131
|
group(_groupName: string): {
|
|
1124
1132
|
sendToAll: () => Promise<void>;
|
|
1125
1133
|
};
|
|
1126
1134
|
}
|
|
1127
1135
|
//#endregion
|
|
1128
1136
|
//#region src/services/container/bodyToBuffer.d.ts
|
|
1129
|
-
declare const bodyToBuffer: (body: HttpRequestBody) => Promise<Buffer>;
|
|
1137
|
+
export declare const bodyToBuffer: (body: HttpRequestBody) => Promise<Buffer>;
|
|
1138
|
+
//#endregion
|
|
1139
|
+
//#region src/services/container/checkIsReadableStream.d.ts
|
|
1140
|
+
export declare const checkIsReadableStream: (value: unknown) => value is NodeJS.ReadableStream;
|
|
1141
|
+
//#endregion
|
|
1142
|
+
//#region src/services/container/constants.d.ts
|
|
1143
|
+
export declare const MOCK_BLOB_SEEDED_DATE: Date;
|
|
1144
|
+
export declare const MOCK_BLOB_SEEDED_PROPERTIES: MockBlobDates;
|
|
1145
|
+
//#endregion
|
|
1146
|
+
//#region src/services/container/deleteMockBlob.d.ts
|
|
1147
|
+
export declare const deleteMockBlob: (containerName: string, blobName: string) => boolean;
|
|
1130
1148
|
//#endregion
|
|
1131
1149
|
//#region src/services/container/getAzureErrorXml.d.ts
|
|
1132
1150
|
/**
|
|
@@ -1135,25 +1153,25 @@ declare const bodyToBuffer: (body: HttpRequestBody) => Promise<Buffer>;
|
|
|
1135
1153
|
* @param errorMessage The user-friendly error message.
|
|
1136
1154
|
* @returns A formatted XML string.
|
|
1137
1155
|
*/
|
|
1138
|
-
declare const getAzureErrorXml: (errorCode: string, errorMessage: string) => string;
|
|
1156
|
+
export declare const getAzureErrorXml: (errorCode: string, errorMessage: string) => string;
|
|
1139
1157
|
//#endregion
|
|
1140
1158
|
//#region src/services/container/getBlobItemXml.d.ts
|
|
1141
|
-
declare const getBlobItemXml: ({ name, properties }: BlobItem) => string;
|
|
1159
|
+
export declare const getBlobItemXml: ({ name, properties }: BlobItem) => string;
|
|
1142
1160
|
//#endregion
|
|
1143
1161
|
//#region src/services/container/getBlobPrefixXml.d.ts
|
|
1144
|
-
declare const getBlobPrefixXml: (name: string) => string;
|
|
1162
|
+
export declare const getBlobPrefixXml: (name: string) => string;
|
|
1145
1163
|
//#endregion
|
|
1146
1164
|
//#region src/services/container/getBlobUrl.d.ts
|
|
1147
|
-
declare const getBlobUrl: (containerName: string, blobName: string) => string;
|
|
1165
|
+
export declare const getBlobUrl: (containerName: string, blobName: string) => string;
|
|
1148
1166
|
//#endregion
|
|
1149
1167
|
//#region src/services/container/getBlobUrlParts.d.ts
|
|
1150
|
-
declare const getBlobUrlParts: (url: string) => undefined | {
|
|
1168
|
+
export declare const getBlobUrlParts: (url: string) => undefined | {
|
|
1151
1169
|
blobName: string;
|
|
1152
1170
|
containerName: string;
|
|
1153
1171
|
};
|
|
1154
1172
|
//#endregion
|
|
1155
1173
|
//#region src/services/container/getListBlobsSegmentResponse.d.ts
|
|
1156
|
-
declare const getListBlobsSegmentResponse: (containerName: string, prefix: string, segment: BlobHierarchyListSegment, blobsXml: string) => ContainerListBlobHierarchySegmentResponse;
|
|
1174
|
+
export declare const getListBlobsSegmentResponse: (containerName: string, prefix: string, segment: BlobHierarchyListSegment, blobsXml: string) => ContainerListBlobHierarchySegmentResponse;
|
|
1157
1175
|
//#endregion
|
|
1158
1176
|
//#region src/services/container/getListBlobsXml.d.ts
|
|
1159
1177
|
/**
|
|
@@ -1162,31 +1180,43 @@ declare const getListBlobsSegmentResponse: (containerName: string, prefix: strin
|
|
|
1162
1180
|
* @param blobsXml The blobs xml data.
|
|
1163
1181
|
* @returns A formatted XML string.
|
|
1164
1182
|
*/
|
|
1165
|
-
declare const getListBlobsXml: (containerName: string, blobsXml: string) => string;
|
|
1183
|
+
export declare const getListBlobsXml: (containerName: string, blobsXml: string) => string;
|
|
1184
|
+
//#endregion
|
|
1185
|
+
//#region src/services/container/getMockBlobKey.d.ts
|
|
1186
|
+
export declare const getMockBlobKey: (containerName: string, blobName: string) => string;
|
|
1166
1187
|
//#endregion
|
|
1167
1188
|
//#region src/services/container/getMockContainer.d.ts
|
|
1168
|
-
declare const getMockContainer: (containerName: string) => MapValue<typeof MockContainerDatabase>;
|
|
1189
|
+
export declare const getMockContainer: (containerName: string) => MapValue<typeof MockContainerDatabase>;
|
|
1169
1190
|
//#endregion
|
|
1170
|
-
//#region src/services/container/
|
|
1171
|
-
declare const
|
|
1191
|
+
//#region src/services/container/readMockBlobDates.d.ts
|
|
1192
|
+
export declare const readMockBlobDates: (containerName: string, blobName: string) => MockBlobDates;
|
|
1193
|
+
//#endregion
|
|
1194
|
+
//#region src/services/container/readMockBlobMetadata.d.ts
|
|
1195
|
+
export declare const readMockBlobMetadata: (containerName: string, blobName: string) => Record<string, string> | undefined;
|
|
1196
|
+
//#endregion
|
|
1197
|
+
//#region src/services/container/storeMockBlobMetadata.d.ts
|
|
1198
|
+
export declare const storeMockBlobMetadata: (containerName: string, blobName: string, metadata: Record<string, string> | undefined) => void;
|
|
1199
|
+
//#endregion
|
|
1200
|
+
//#region src/services/container/storeMockBlobWrite.d.ts
|
|
1201
|
+
export declare const storeMockBlobWrite: (containerName: string, blobName: string, isExisting: boolean) => void;
|
|
1172
1202
|
//#endregion
|
|
1173
1203
|
//#region src/services/container/toWebResourceLike.d.ts
|
|
1174
|
-
declare const toWebResourceLike: (request: PipelineRequest) => WebResourceLike;
|
|
1204
|
+
export declare const toWebResourceLike: (request: PipelineRequest) => WebResourceLike;
|
|
1175
1205
|
//#endregion
|
|
1176
1206
|
//#region src/services/filter/applyFilter.d.ts
|
|
1177
|
-
declare const applyFilter: <T extends Record<string, unknown>>(documents: T[], clauses: Clause<T>[]) => T[];
|
|
1207
|
+
export declare const applyFilter: <T extends Record<string, unknown>>(documents: T[], clauses: Clause<T>[]) => T[];
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region src/services/filter/checkIsNullClause.d.ts
|
|
1210
|
+
export declare const checkIsNullClause: (clause: Clause<Record<string, unknown>>) => boolean;
|
|
1178
1211
|
//#endregion
|
|
1179
1212
|
//#region src/services/filter/compare.d.ts
|
|
1180
|
-
declare const compare: <T>(operator: BinaryOperator, leftHandSide: T, rightHandSide: null | T) => boolean;
|
|
1213
|
+
export declare const compare: <T>(operator: BinaryOperator, leftHandSide: T, rightHandSide: null | T) => boolean;
|
|
1181
1214
|
//#endregion
|
|
1182
1215
|
//#region src/services/filter/createFilterPredicate.d.ts
|
|
1183
|
-
declare const createFilterPredicate: (filter: string) => ((document: Record<string, unknown>) => boolean);
|
|
1184
|
-
//#endregion
|
|
1185
|
-
//#region src/services/filter/isNullClause.d.ts
|
|
1186
|
-
declare const isNullClause: (clause: Clause<Record<string, unknown>>) => boolean;
|
|
1216
|
+
export declare const createFilterPredicate: (filter: string) => ((document: Record<string, unknown>) => boolean);
|
|
1187
1217
|
//#endregion
|
|
1188
1218
|
//#region src/services/queue/getMockQueueMessageItem.d.ts
|
|
1189
|
-
declare const getMockQueueMessageItem: (messageText: string) => {
|
|
1219
|
+
export declare const getMockQueueMessageItem: (messageText: string) => {
|
|
1190
1220
|
expiresOn: Date;
|
|
1191
1221
|
insertedOn: Date;
|
|
1192
1222
|
messageId: string;
|
|
@@ -1194,6 +1224,5 @@ declare const getMockQueueMessageItem: (messageText: string) => {
|
|
|
1194
1224
|
};
|
|
1195
1225
|
//#endregion
|
|
1196
1226
|
//#region src/services/table/compareByCompositeKey.d.ts
|
|
1197
|
-
declare const compareByCompositeKey: (
|
|
1198
|
-
//#endregion
|
|
1199
|
-
export { BLOB_NOT_FOUND_ERROR_CODE, BLOB_NOT_FOUND_MESSAGE, BlobHierarchyItem, MOCK_BLOB_BASE_URL, MOCK_BLOB_SEEDED_CREATED_ON, MOCK_QUEUE_BASE_URL, MOCK_SEARCH_BASE_URL, MOCK_TABLE_BASE_URL, MockBlobBatchClient, MockBlobClient, MockBlockBlobClient, MockContainerClient, MockContainerCreatedOnDatabase, MockContainerDatabase, MockEventGridDatabase, MockEventGridPublisherClient, MockQueueClient, MockQueueDatabase, MockResponse, MockRestError, MockSearchClient, MockSearchDatabase, MockServiceBusDatabase, MockServiceBusSender, MockTableClient, MockTableDatabase, MockWebPubSubServiceClient, PageSettings, PagedAsyncIterableIterator, applyFilter, bodyToBuffer, compare, compareByCompositeKey, createFilterPredicate, createMockResponse, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, getBlobUrl, getBlobUrlParts, getListBlobsSegmentResponse, getListBlobsXml, getMockContainer, getMockContainerCreatedOnKey, getMockQueueMessageItem, getMockSasUrl, isNullClause, isReadableStream, toWebResourceLike };
|
|
1227
|
+
export declare const compareByCompositeKey: (firstEntity: TableEntity, secondEntity: TableEntity) => number;
|
|
1228
|
+
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -59,16 +59,18 @@ const createMockResponse = (status, url = "") => ({
|
|
|
59
59
|
//#region src/services/getMockSasUrl.ts
|
|
60
60
|
const getMockSasUrl = (url, permissions, resourceType) => `${url}?sv=2025-11-05&${resourceType ? `sr=${resourceType}&` : ""}sig=mock-signature&st=1970-01-01T00:00:00Z&se=2099-12-31T23:59:59Z&sp=${permissions?.toString() ?? "r"}`;
|
|
61
61
|
//#endregion
|
|
62
|
-
//#region src/store/
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
//#region src/store/MockContainerBlobDatesDatabase.ts
|
|
63
|
+
const MockContainerBlobDatesDatabase = /* @__PURE__ */ new Map();
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/store/MockContainerBlobMetadataDatabase.ts
|
|
66
|
+
const MockContainerBlobMetadataDatabase = /* @__PURE__ */ new Map();
|
|
66
67
|
//#endregion
|
|
67
68
|
//#region src/store/MockContainerDatabase.ts
|
|
68
69
|
var MockContainerDatabaseMap = class extends Map {
|
|
69
70
|
clear() {
|
|
70
71
|
super.clear();
|
|
71
|
-
|
|
72
|
+
MockContainerBlobDatesDatabase.clear();
|
|
73
|
+
MockContainerBlobMetadataDatabase.clear();
|
|
72
74
|
}
|
|
73
75
|
};
|
|
74
76
|
const MockContainerDatabase = new MockContainerDatabaseMap();
|
|
@@ -88,6 +90,27 @@ const MockServiceBusDatabase = /* @__PURE__ */ new Map();
|
|
|
88
90
|
//#region src/store/MockTableDatabase.ts
|
|
89
91
|
const MockTableDatabase = /* @__PURE__ */ new Map();
|
|
90
92
|
//#endregion
|
|
93
|
+
//#region src/services/container/getMockBlobKey.ts
|
|
94
|
+
const getMockBlobKey = (containerName, blobName) => `${encodeURIComponent(containerName)}${ID_SEPARATOR}${encodeURIComponent(blobName)}`;
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/services/container/getMockContainer.ts
|
|
97
|
+
const getMockContainer = (containerName) => getOrCreate(MockContainerDatabase, containerName, () => /* @__PURE__ */ new Map());
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/services/container/storeMockBlobMetadata.ts
|
|
100
|
+
const storeMockBlobMetadata = (containerName, blobName, metadata) => {
|
|
101
|
+
const key = getMockBlobKey(containerName, blobName);
|
|
102
|
+
if (metadata) MockContainerBlobMetadataDatabase.set(key, metadata);
|
|
103
|
+
else MockContainerBlobMetadataDatabase.delete(key);
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/services/container/deleteMockBlob.ts
|
|
107
|
+
const deleteMockBlob = (containerName, blobName) => {
|
|
108
|
+
if (!getMockContainer(containerName).delete(blobName)) return false;
|
|
109
|
+
MockContainerBlobDatesDatabase.delete(getMockBlobKey(containerName, blobName));
|
|
110
|
+
storeMockBlobMetadata(containerName, blobName, void 0);
|
|
111
|
+
return true;
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
91
114
|
//#region src/services/container/getAzureErrorXml.ts
|
|
92
115
|
/**
|
|
93
116
|
* Generates a standard Azure Storage error XML response body.
|
|
@@ -114,9 +137,6 @@ const getBlobUrlParts = (url) => {
|
|
|
114
137
|
};
|
|
115
138
|
};
|
|
116
139
|
//#endregion
|
|
117
|
-
//#region src/services/container/getMockContainer.ts
|
|
118
|
-
const getMockContainer = (containerName) => getOrCreate(MockContainerDatabase, containerName, () => /* @__PURE__ */ new Map());
|
|
119
|
-
//#endregion
|
|
120
140
|
//#region src/models/container/MockBlobBatchClient.ts
|
|
121
141
|
var MockBlobBatchClient = class {
|
|
122
142
|
url;
|
|
@@ -141,10 +161,7 @@ var MockBlobBatchClient = class {
|
|
|
141
161
|
continue;
|
|
142
162
|
}
|
|
143
163
|
const { blobName, containerName } = urlParts;
|
|
144
|
-
|
|
145
|
-
if (container.has(blobName)) {
|
|
146
|
-
container.delete(blobName);
|
|
147
|
-
MockContainerCreatedOnDatabase.delete(getMockContainerCreatedOnKey(containerName, blobName));
|
|
164
|
+
if (deleteMockBlob(containerName, blobName)) {
|
|
148
165
|
subResponses.push({
|
|
149
166
|
_request: {
|
|
150
167
|
credential,
|
|
@@ -194,6 +211,28 @@ var MockBlobBatchClient = class {
|
|
|
194
211
|
//#region src/services/container/getBlobUrl.ts
|
|
195
212
|
const getBlobUrl = (containerName, blobName) => `${MOCK_BLOB_BASE_URL}/${containerName}/${blobName.split("/").map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
196
213
|
//#endregion
|
|
214
|
+
//#region src/services/container/constants.ts
|
|
215
|
+
const MOCK_BLOB_SEEDED_DATE = /* @__PURE__ */ new Date(-864e13);
|
|
216
|
+
const MOCK_BLOB_SEEDED_PROPERTIES = {
|
|
217
|
+
createdOn: MOCK_BLOB_SEEDED_DATE,
|
|
218
|
+
etag: "\"seeded\"",
|
|
219
|
+
lastModified: MOCK_BLOB_SEEDED_DATE
|
|
220
|
+
};
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/services/container/readMockBlobDates.ts
|
|
223
|
+
const readMockBlobDates = (containerName, blobName) => MockContainerBlobDatesDatabase.get(getMockBlobKey(containerName, blobName)) ?? MOCK_BLOB_SEEDED_PROPERTIES;
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/services/container/storeMockBlobWrite.ts
|
|
226
|
+
const storeMockBlobWrite = (containerName, blobName, isExisting) => {
|
|
227
|
+
const key = getMockBlobKey(containerName, blobName);
|
|
228
|
+
const lastModified = /* @__PURE__ */ new Date();
|
|
229
|
+
MockContainerBlobDatesDatabase.set(key, {
|
|
230
|
+
createdOn: MockContainerBlobDatesDatabase.get(key)?.createdOn ?? (isExisting ? MOCK_BLOB_SEEDED_DATE : lastModified),
|
|
231
|
+
etag: `"${crypto.randomUUID()}"`,
|
|
232
|
+
lastModified
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
//#endregion
|
|
197
236
|
//#region src/models/container/MockBlobClient.ts
|
|
198
237
|
var MockBlobClient = class {
|
|
199
238
|
connectionString;
|
|
@@ -221,8 +260,8 @@ var MockBlobClient = class {
|
|
|
221
260
|
if (!sourceContainer) throw new MockRestError("Source container not found", 404);
|
|
222
261
|
const sourceData = sourceContainer.get(sourceBlobName);
|
|
223
262
|
if (!sourceData) throw new MockRestError("Source blob not found", 404);
|
|
263
|
+
storeMockBlobWrite(this.containerName, this.name, this.container.has(this.name));
|
|
224
264
|
this.container.set(this.name, Buffer.from(sourceData));
|
|
225
|
-
MockContainerCreatedOnDatabase.set(getMockContainerCreatedOnKey(this.containerName, this.name), /* @__PURE__ */ new Date());
|
|
226
265
|
const response = { _response: createMockResponse(202, `${this.url}?comp=copy`) };
|
|
227
266
|
return Promise.resolve({
|
|
228
267
|
cancelOperation: () => Promise.resolve(),
|
|
@@ -245,14 +284,14 @@ var MockBlobClient = class {
|
|
|
245
284
|
delete() {
|
|
246
285
|
if (!this.container.has(this.name)) throw new MockRestError(BLOB_NOT_FOUND_MESSAGE, 404);
|
|
247
286
|
this.container.delete(this.name);
|
|
248
|
-
|
|
287
|
+
MockContainerBlobDatesDatabase.delete(getMockBlobKey(this.containerName, this.name));
|
|
249
288
|
return Promise.resolve({ _response: createMockResponse(200) });
|
|
250
289
|
}
|
|
251
290
|
deleteIfExists() {
|
|
252
291
|
const succeeded = this.container.has(this.name);
|
|
253
292
|
if (succeeded) {
|
|
254
293
|
this.container.delete(this.name);
|
|
255
|
-
|
|
294
|
+
MockContainerBlobDatesDatabase.delete(getMockBlobKey(this.containerName, this.name));
|
|
256
295
|
}
|
|
257
296
|
return Promise.resolve({
|
|
258
297
|
_response: createMockResponse(succeeded ? 200 : 404),
|
|
@@ -313,7 +352,7 @@ var MockBlobClient = class {
|
|
|
313
352
|
return Promise.resolve({
|
|
314
353
|
_response: createMockResponse(200),
|
|
315
354
|
contentLength: blob.byteLength,
|
|
316
|
-
|
|
355
|
+
...readMockBlobDates(this.containerName, this.name)
|
|
317
356
|
});
|
|
318
357
|
}
|
|
319
358
|
getTags() {
|
|
@@ -351,8 +390,8 @@ var MockBlobClient = class {
|
|
|
351
390
|
}
|
|
352
391
|
};
|
|
353
392
|
//#endregion
|
|
354
|
-
//#region src/services/container/
|
|
355
|
-
const
|
|
393
|
+
//#region src/services/container/checkIsReadableStream.ts
|
|
394
|
+
const checkIsReadableStream = (value) => value instanceof Readable;
|
|
356
395
|
//#endregion
|
|
357
396
|
//#region src/services/container/bodyToBuffer.ts
|
|
358
397
|
const bodyToBuffer = async (body) => {
|
|
@@ -366,7 +405,7 @@ const bodyToBuffer = async (body) => {
|
|
|
366
405
|
} else if (body instanceof Blob) {
|
|
367
406
|
const arrayBuffer = await body.arrayBuffer();
|
|
368
407
|
return Buffer.from(arrayBuffer);
|
|
369
|
-
} else if (
|
|
408
|
+
} else if (checkIsReadableStream(body)) return Buffer.from(await streamToText(body));
|
|
370
409
|
else if (body instanceof ReadableStream) {
|
|
371
410
|
const reader = body.getReader();
|
|
372
411
|
const chunks = [];
|
|
@@ -406,8 +445,10 @@ var MockBlockBlobClient = class extends MockBlobClient {
|
|
|
406
445
|
async upload(body, _contentLength, options) {
|
|
407
446
|
const buffer = await bodyToBuffer(body);
|
|
408
447
|
if (options?.conditions?.ifNoneMatch === "*" && this.container.has(this.name)) throw new MockRestError("The specified blob already exists.", 409);
|
|
448
|
+
if (options?.conditions?.ifMatch !== void 0 && options.conditions.ifMatch !== (this.container.has(this.name) ? readMockBlobDates(this.containerName, this.name).etag : void 0)) throw new MockRestError("The condition specified using HTTP conditional header(s) is not met.", 412);
|
|
449
|
+
storeMockBlobWrite(this.containerName, this.name, this.container.has(this.name));
|
|
450
|
+
storeMockBlobMetadata(this.containerName, this.name, options?.metadata);
|
|
409
451
|
this.container.set(this.name, buffer);
|
|
410
|
-
MockContainerCreatedOnDatabase.set(getMockContainerCreatedOnKey(this.containerName, this.name), /* @__PURE__ */ new Date());
|
|
411
452
|
return { _response: createMockResponse(201) };
|
|
412
453
|
}
|
|
413
454
|
uploadBrowserData() {
|
|
@@ -473,6 +514,9 @@ const getListBlobsSegmentResponse = (containerName, prefix, segment, blobsXml) =
|
|
|
473
514
|
};
|
|
474
515
|
};
|
|
475
516
|
//#endregion
|
|
517
|
+
//#region src/services/container/readMockBlobMetadata.ts
|
|
518
|
+
const readMockBlobMetadata = (containerName, blobName) => MockContainerBlobMetadataDatabase.get(getMockBlobKey(containerName, blobName));
|
|
519
|
+
//#endregion
|
|
476
520
|
//#region src/models/container/MockContainerClient.ts
|
|
477
521
|
/**
|
|
478
522
|
* An in-memory mock of the Azure ContainerClient — no emulator and no network.
|
|
@@ -506,9 +550,7 @@ var MockContainerClient = class {
|
|
|
506
550
|
throw new Error("Method not implemented.");
|
|
507
551
|
}
|
|
508
552
|
deleteBlob(blobName) {
|
|
509
|
-
if (!this.
|
|
510
|
-
this.container.delete(blobName);
|
|
511
|
-
MockContainerCreatedOnDatabase.delete(getMockContainerCreatedOnKey(this.containerName, blobName));
|
|
553
|
+
if (!deleteMockBlob(this.containerName, blobName)) throw new MockRestError(BLOB_NOT_FOUND_MESSAGE, 404);
|
|
512
554
|
return Promise.resolve({ _response: createMockResponse(200, getBlobUrl(this.containerName, blobName)) });
|
|
513
555
|
}
|
|
514
556
|
deleteIfExists() {
|
|
@@ -624,7 +666,7 @@ var MockContainerClient = class {
|
|
|
624
666
|
if (!name.startsWith(prefix)) continue;
|
|
625
667
|
const nameAfterPrefix = name.slice(prefix.length);
|
|
626
668
|
const delimiterIndex = nameAfterPrefix.indexOf(delimiter);
|
|
627
|
-
if (delimiterIndex === -1) blobsInCurrentLevel.push(this.#getBlobItem(name, buffer));
|
|
669
|
+
if (delimiterIndex === -1) blobsInCurrentLevel.push(this.#getBlobItem(name, buffer, options?.includeMetadata));
|
|
628
670
|
else {
|
|
629
671
|
const subprefix = `${prefix}${nameAfterPrefix.slice(0, delimiterIndex + delimiter.length)}`;
|
|
630
672
|
uniqueSubprefixes.add(subprefix);
|
|
@@ -639,17 +681,19 @@ var MockContainerClient = class {
|
|
|
639
681
|
...blobItem
|
|
640
682
|
});
|
|
641
683
|
}
|
|
642
|
-
#getBlobItem(name, buffer) {
|
|
684
|
+
#getBlobItem(name, buffer, isMetadataIncluded) {
|
|
685
|
+
const { createdOn, etag, lastModified } = readMockBlobDates(this.containerName, name);
|
|
643
686
|
return {
|
|
644
687
|
deleted: false,
|
|
688
|
+
...isMetadataIncluded && { metadata: readMockBlobMetadata(this.containerName, name) },
|
|
645
689
|
name,
|
|
646
690
|
properties: {
|
|
647
691
|
blobType: "BlockBlob",
|
|
648
692
|
contentLength: buffer.length,
|
|
649
693
|
contentType: "application/octet-stream",
|
|
650
|
-
createdOn
|
|
651
|
-
etag
|
|
652
|
-
lastModified
|
|
694
|
+
createdOn,
|
|
695
|
+
etag,
|
|
696
|
+
lastModified,
|
|
653
697
|
leaseState: "available",
|
|
654
698
|
leaseStatus: "unlocked"
|
|
655
699
|
},
|
|
@@ -660,7 +704,7 @@ var MockContainerClient = class {
|
|
|
660
704
|
const prefix = options?.prefix ?? "";
|
|
661
705
|
for (const [name, buffer] of this.container.entries()) {
|
|
662
706
|
if (!name.startsWith(prefix)) continue;
|
|
663
|
-
yield await Promise.resolve(this.#getBlobItem(name, buffer));
|
|
707
|
+
yield await Promise.resolve(this.#getBlobItem(name, buffer, options?.includeMetadata));
|
|
664
708
|
}
|
|
665
709
|
}
|
|
666
710
|
};
|
|
@@ -830,6 +874,12 @@ var MockQueueClient = class {
|
|
|
830
874
|
}
|
|
831
875
|
};
|
|
832
876
|
//#endregion
|
|
877
|
+
//#region src/services/filter/checkIsNullClause.ts
|
|
878
|
+
const checkIsNullClause = (clause) => {
|
|
879
|
+
const tableNullClause = getTableNullClause(clause.key);
|
|
880
|
+
return deepEqual(clause, tableNullClause);
|
|
881
|
+
};
|
|
882
|
+
//#endregion
|
|
833
883
|
//#region src/services/filter/compare.ts
|
|
834
884
|
const compare = (operator, leftHandSide, rightHandSide) => {
|
|
835
885
|
if (rightHandSide === null || rightHandSide === void 0) {
|
|
@@ -851,19 +901,13 @@ const compare = (operator, leftHandSide, rightHandSide) => {
|
|
|
851
901
|
}
|
|
852
902
|
};
|
|
853
903
|
//#endregion
|
|
854
|
-
//#region src/services/filter/isNullClause.ts
|
|
855
|
-
const isNullClause = (clause) => {
|
|
856
|
-
const tableNullClause = getTableNullClause(clause.key);
|
|
857
|
-
return deepEqual(clause, tableNullClause);
|
|
858
|
-
};
|
|
859
|
-
//#endregion
|
|
860
904
|
//#region src/services/filter/createFilterPredicate.ts
|
|
861
905
|
const createFilterPredicate = (filter) => {
|
|
862
906
|
const orGroups = filter.replaceAll(String.raw`(`, " ").replaceAll(String.raw`)`, "").split(/\s+and\s+/iu).filter(Boolean).map((group) => group.split(/\s+or\s+/iu).filter(Boolean).map((clauseString) => {
|
|
863
907
|
const clause = deserializeClause(clauseString);
|
|
864
908
|
return {
|
|
865
909
|
clause,
|
|
866
|
-
isNull:
|
|
910
|
+
isNull: checkIsNullClause(clause)
|
|
867
911
|
};
|
|
868
912
|
}));
|
|
869
913
|
return (document) => {
|
|
@@ -894,11 +938,11 @@ const toComparable = (value) => {
|
|
|
894
938
|
else if (typeof value === "number" || typeof value === "string") return value;
|
|
895
939
|
else return String(value);
|
|
896
940
|
};
|
|
897
|
-
const compareValues = (
|
|
898
|
-
const
|
|
899
|
-
const
|
|
900
|
-
if (typeof
|
|
901
|
-
return String(
|
|
941
|
+
const compareValues = (firstValue, secondValue) => {
|
|
942
|
+
const firstComparable = toComparable(firstValue);
|
|
943
|
+
const secondComparable = toComparable(secondValue);
|
|
944
|
+
if (typeof firstComparable === "number" && typeof secondComparable === "number") return firstComparable - secondComparable;
|
|
945
|
+
return String(firstComparable).localeCompare(String(secondComparable));
|
|
902
946
|
};
|
|
903
947
|
const sortDocuments = (documents, orderBy) => {
|
|
904
948
|
const parsedOrderBy = orderBy.map((clause) => {
|
|
@@ -908,9 +952,9 @@ const sortDocuments = (documents, orderBy) => {
|
|
|
908
952
|
key: deserializeKey(field)
|
|
909
953
|
};
|
|
910
954
|
});
|
|
911
|
-
return documents.toSorted((
|
|
955
|
+
return documents.toSorted((firstDocument, secondDocument) => {
|
|
912
956
|
for (const { direction, key } of parsedOrderBy) {
|
|
913
|
-
const comparison = compareValues(
|
|
957
|
+
const comparison = compareValues(firstDocument[key], secondDocument[key]);
|
|
914
958
|
if (comparison !== 0) return direction === "desc" ? -comparison : comparison;
|
|
915
959
|
}
|
|
916
960
|
return 0;
|
|
@@ -918,10 +962,11 @@ const sortDocuments = (documents, orderBy) => {
|
|
|
918
962
|
};
|
|
919
963
|
const getSearchFieldValues = (value, pathSegments) => {
|
|
920
964
|
if (pathSegments.length === 0) return [value];
|
|
921
|
-
if (Array.isArray(value)) return value.flatMap((item) => getSearchFieldValues(item, pathSegments));
|
|
922
|
-
if (typeof value
|
|
923
|
-
|
|
924
|
-
|
|
965
|
+
else if (Array.isArray(value)) return value.flatMap((item) => getSearchFieldValues(item, pathSegments));
|
|
966
|
+
else if (typeof value === "object" && value !== null) {
|
|
967
|
+
const [field = "", ...remainingPathSegments] = pathSegments;
|
|
968
|
+
return getSearchFieldValues(value[deserializeKey(field)], remainingPathSegments);
|
|
969
|
+
} else return [];
|
|
925
970
|
};
|
|
926
971
|
const searchDocuments = (documents, searchText, searchFields) => {
|
|
927
972
|
if (!searchText || searchText === "*") return documents;
|
|
@@ -1041,10 +1086,10 @@ var MockServiceBusSender = class {
|
|
|
1041
1086
|
};
|
|
1042
1087
|
//#endregion
|
|
1043
1088
|
//#region src/services/table/compareByCompositeKey.ts
|
|
1044
|
-
const compareByCompositeKey = (
|
|
1045
|
-
if (
|
|
1046
|
-
else if (
|
|
1047
|
-
else return
|
|
1089
|
+
const compareByCompositeKey = (firstEntity, secondEntity) => {
|
|
1090
|
+
if (firstEntity.partitionKey !== secondEntity.partitionKey) return firstEntity.partitionKey < secondEntity.partitionKey ? -1 : 1;
|
|
1091
|
+
else if (firstEntity.rowKey === secondEntity.rowKey) return 0;
|
|
1092
|
+
else return firstEntity.rowKey < secondEntity.rowKey ? -1 : 1;
|
|
1048
1093
|
};
|
|
1049
1094
|
//#endregion
|
|
1050
1095
|
//#region src/models/table/MockTableClient.ts
|
|
@@ -1213,7 +1258,7 @@ var MockTableClient = class {
|
|
|
1213
1258
|
});
|
|
1214
1259
|
}
|
|
1215
1260
|
#getCompositeKey(partitionKey, rowKey) {
|
|
1216
|
-
return `${partitionKey}${ID_SEPARATOR}${rowKey}`;
|
|
1261
|
+
return `${encodeURIComponent(partitionKey)}${ID_SEPARATOR}${encodeURIComponent(rowKey)}`;
|
|
1217
1262
|
}
|
|
1218
1263
|
#getEtag() {
|
|
1219
1264
|
return `W/"${crypto.randomUUID()}"`;
|
|
@@ -1243,4 +1288,4 @@ const applyFilter = (documents, clauses) => {
|
|
|
1243
1288
|
return documents.filter((document) => predicate(document));
|
|
1244
1289
|
};
|
|
1245
1290
|
//#endregion
|
|
1246
|
-
export { BLOB_NOT_FOUND_ERROR_CODE, BLOB_NOT_FOUND_MESSAGE, MOCK_BLOB_BASE_URL,
|
|
1291
|
+
export { BLOB_NOT_FOUND_ERROR_CODE, BLOB_NOT_FOUND_MESSAGE, MOCK_BLOB_BASE_URL, MOCK_BLOB_SEEDED_DATE, MOCK_BLOB_SEEDED_PROPERTIES, MOCK_QUEUE_BASE_URL, MOCK_SEARCH_BASE_URL, MOCK_TABLE_BASE_URL, MockBlobBatchClient, MockBlobClient, MockBlockBlobClient, MockContainerBlobDatesDatabase, MockContainerBlobMetadataDatabase, MockContainerClient, MockContainerDatabase, MockEventGridDatabase, MockEventGridPublisherClient, MockQueueClient, MockQueueDatabase, MockRestError, MockSearchClient, MockSearchDatabase, MockServiceBusDatabase, MockServiceBusSender, MockTableClient, MockTableDatabase, MockWebPubSubServiceClient, applyFilter, bodyToBuffer, checkIsNullClause, checkIsReadableStream, compare, compareByCompositeKey, createFilterPredicate, createMockResponse, deleteMockBlob, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, getBlobUrl, getBlobUrlParts, getListBlobsSegmentResponse, getListBlobsXml, getMockBlobKey, getMockContainer, getMockQueueMessageItem, getMockSasUrl, readMockBlobDates, readMockBlobMetadata, storeMockBlobMetadata, storeMockBlobWrite, toWebResourceLike };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-mock",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.40.0",
|
|
4
4
|
"description": "A library that contains azure mock classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"azure",
|
|
@@ -44,29 +44,28 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
|
-
"build": "
|
|
48
|
-
"export:gen": "
|
|
47
|
+
"build": "tsdown",
|
|
48
|
+
"export:gen": "generate-exports",
|
|
49
49
|
"format": "oxfmt",
|
|
50
50
|
"format:check": "oxfmt --check",
|
|
51
51
|
"lint": "eslint .",
|
|
52
52
|
"lint:fix": "eslint --fix .",
|
|
53
53
|
"test": "vitest",
|
|
54
|
-
"typecheck": "
|
|
54
|
+
"typecheck": "tsc"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@esposter/azure": "2.
|
|
58
|
-
"@esposter/shared": "2.
|
|
57
|
+
"@esposter/azure": "2.40.0",
|
|
58
|
+
"@esposter/shared": "2.40.0",
|
|
59
59
|
"fast-deep-equal": "^3.1.3"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@arethetypeswrong/core": "^0.18.5",
|
|
63
|
-
"@esposter/configuration": "2.
|
|
64
|
-
"ctix": "^2.8.2",
|
|
63
|
+
"@esposter/configuration": "2.40.0",
|
|
65
64
|
"publint": "^0.3.24",
|
|
66
|
-
"tsdown": "^0.
|
|
67
|
-
"type-fest": "^5.
|
|
65
|
+
"tsdown": "^0.23.0",
|
|
66
|
+
"type-fest": "^5.9.0",
|
|
68
67
|
"typedoc": "^0.28.20",
|
|
69
|
-
"vitest": "^
|
|
68
|
+
"vitest": "^5.0.0"
|
|
70
69
|
},
|
|
71
70
|
"peerDependencies": {
|
|
72
71
|
"@azure/core-http-compat": "^2.5.0",
|
|
@@ -79,7 +78,7 @@
|
|
|
79
78
|
"@azure/storage-queue": "^12.31.0"
|
|
80
79
|
},
|
|
81
80
|
"inlinedDependencies": {
|
|
82
|
-
"type-fest": "5.
|
|
81
|
+
"type-fest": "5.9.0"
|
|
83
82
|
},
|
|
84
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "09506078db97923eeecb4ff602cf01015f237dc8"
|
|
85
84
|
}
|