azure-mock 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -867,6 +867,15 @@ declare const getBlobItemXml: ({
867
867
  //#region src/util/getBlobPrefixXml.d.ts
868
868
  declare const getBlobPrefixXml: (name: string) => string;
869
869
  //#endregion
870
+ //#region src/util/getListBlobsXml.d.ts
871
+ /**
872
+ * Generates a standard Azure Storage list blobs XML response body.
873
+ * @param containerName The container name.
874
+ * @param blobsXml The blobs xml data.
875
+ * @returns A formatted XML string.
876
+ */
877
+ declare const getListBlobsXml: (containerName: string, blobsXml: string) => string;
878
+ //#endregion
870
879
  //#region src/util/isReadableStream.d.ts
871
880
  declare const isReadableStream: (value: unknown) => value is NodeJS.ReadableStream;
872
881
  //#endregion
@@ -1521,4 +1530,4 @@ type TransferProgressEvent = {
1521
1530
  //#region src/util/toWebResourceLike.d.ts
1522
1531
  declare const toWebResourceLike: (request: PipelineRequest) => WebResourceLike;
1523
1532
  //#endregion
1524
- export { BlobHierarchyItem, MockBlobBatchClient, MockBlobClient, MockBlockBlobClient, MockContainerClient, MockContainerDatabase, MockRestError, MockTableClient, MockTableDatabase, PageSettings, PagedAsyncIterableIterator, bodyToBuffer, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, isReadableStream, toWebResourceLike };
1533
+ export { BlobHierarchyItem, MockBlobBatchClient, MockBlobClient, MockBlockBlobClient, MockContainerClient, MockContainerDatabase, MockRestError, MockTableClient, MockTableDatabase, PageSettings, PagedAsyncIterableIterator, bodyToBuffer, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, getListBlobsXml, isReadableStream, toWebResourceLike };
package/dist/index.js CHANGED
@@ -816,6 +816,20 @@ const getBlobItemXml = ({ name, properties }) => html`<Blob>
816
816
  //#region src/util/getBlobPrefixXml.ts
817
817
  const getBlobPrefixXml = (name) => html`<BlobPrefix><Name>${name}</Name></BlobPrefix>`;
818
818
 
819
+ //#endregion
820
+ //#region src/util/getListBlobsXml.ts
821
+ /**
822
+ * Generates a standard Azure Storage list blobs XML response body.
823
+ * @param containerName The container name.
824
+ * @param blobsXml The blobs xml data.
825
+ * @returns A formatted XML string.
826
+ */
827
+ const getListBlobsXml = (containerName, blobsXml) => html`<?xml version="1.0" encoding="utf8"?>
828
+ <EnumerationResults ServiceEndpoint="" ContainerName="${containerName}">
829
+ <Blobs>${blobsXml}</Blobs>
830
+ <NextMarker />
831
+ </EnumerationResults>`;
832
+
819
833
  //#endregion
820
834
  //#region src/models/MockContainerClient.ts
821
835
  /**
@@ -923,11 +937,7 @@ var MockContainerClient = class {
923
937
  }
924
938
  if (allBlobItems.length > 0 || allBlobPrefixes.length > 0) yield await Promise.resolve({
925
939
  _response: {
926
- bodyAsText: html`<?xml version="1.0" encoding="utf8"?>
927
- <EnumerationResults ServiceEndpoint="" ContainerName="${this.containerName}">
928
- <Blobs>${allBlobItemXml.join("")}${allBlobPrefixXml.join("")}</Blobs>
929
- <NextMarker />
930
- </EnumerationResults>`,
940
+ bodyAsText: getListBlobsXml(this.containerName, `${allBlobItemXml.join("")}${allBlobPrefixXml.join("")}`),
931
941
  headers: toHttpHeadersLike(createHttpHeaders()),
932
942
  parsedBody: {
933
943
  containerName: this.containerName,
@@ -965,11 +975,7 @@ var MockContainerClient = class {
965
975
  }
966
976
  if (allBlobItems.length > 0) yield await Promise.resolve({
967
977
  _response: {
968
- bodyAsText: html`<?xml version="1.0" encoding="utf8"?>
969
- <EnumerationResults ServiceEndpoint="" ContainerName="${this.containerName}">
970
- <Blobs>${allBlobItemXml.join("")}</Blobs>
971
- <NextMarker />
972
- </EnumerationResults>`,
978
+ bodyAsText: getListBlobsXml(this.containerName, allBlobItemXml.join("")),
973
979
  headers: toHttpHeadersLike(createHttpHeaders()),
974
980
  parsedBody: {
975
981
  containerName: this.containerName,
@@ -1194,4 +1200,4 @@ var MockTableClient = class {
1194
1200
  };
1195
1201
 
1196
1202
  //#endregion
1197
- export { MockBlobBatchClient, MockBlobClient, MockBlockBlobClient, MockContainerClient, MockContainerDatabase, MockRestError, MockTableClient, MockTableDatabase, bodyToBuffer, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, isReadableStream, toWebResourceLike };
1203
+ export { MockBlobBatchClient, MockBlobClient, MockBlockBlobClient, MockContainerClient, MockContainerDatabase, MockRestError, MockTableClient, MockTableDatabase, bodyToBuffer, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, getListBlobsXml, isReadableStream, toWebResourceLike };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-mock",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "A library that contains azure mock classes.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/Esposter/Esposter#readme",
@@ -34,5 +34,5 @@
34
34
  "@azure/data-tables": "^13.3.1",
35
35
  "@azure/storage-blob": "^12.27.0"
36
36
  },
37
- "gitHead": "3c28bf80b721c67e7c0fc52f23cdd9df2a092f93"
37
+ "gitHead": "a094ff58832d6a54485dadc5d349a72db80b326c"
38
38
  }