azure-mock 3.0.0 → 3.2.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/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { PipelineRequest, RestError } from "@azure/core-rest-pipeline";
2
1
  import { HttpHeadersLike, WebResourceLike } from "@azure/core-http-compat";
3
- import { MapValue } from "@esposter/shared";
2
+ import { PipelineRequest, RestError } from "@azure/core-rest-pipeline";
4
3
  import { AnonymousCredential, AppendBlobClient, BlobAbortCopyFromURLResponse, BlobBatchClient, BlobBatchDeleteBlobsResponse, BlobBeginCopyFromURLResponse, BlobClient, BlobCopyFromURLResponse, BlobCreateSnapshotResponse, BlobDeleteIfExistsResponse, BlobDeleteImmutabilityPolicyResponse, BlobDeleteOptions, BlobDeleteResponse, BlobDownloadResponseModel, BlobDownloadResponseParsed, BlobGenerateSasUrlOptions, BlobGetAccountInfoResponse, BlobGetPropertiesResponse, BlobGetTagsResponse, BlobHierarchyListSegment, BlobItem, BlobLeaseClient, BlobPrefix, BlobSetHTTPHeadersResponse, BlobSetImmutabilityPolicyResponse, BlobSetLegalHoldResponse, BlobSetMetadataResponse, BlobSetTagsResponse, BlobSetTierResponse, BlobUndeleteResponse, BlobUploadCommonResponse, BlockBlobClient, BlockBlobCommitBlockListResponse, BlockBlobGetBlockListResponse, BlockBlobPutBlobFromUrlResponse, BlockBlobStageBlockFromURLResponse, BlockBlobStageBlockResponse, BlockBlobUploadOptions, BlockBlobUploadResponse, ContainerClient, ContainerCreateIfNotExistsResponse, ContainerCreateResponse, ContainerDeleteIfExistsResponse, ContainerDeleteResponse, ContainerFindBlobsByTagsSegmentResponse, ContainerGenerateSasUrlOptions, ContainerGetAccessPolicyResponse, ContainerGetAccountInfoResponse, ContainerGetPropertiesResponse, ContainerListBlobFlatSegmentResponse, ContainerListBlobHierarchySegmentResponse, ContainerListBlobsOptions, ContainerSetAccessPolicyResponse, ContainerSetMetadataResponse, FilterBlobItem, HttpRequestBody, PageBlobClient, PollOperationState, PollerLikeWithCancellation, StorageSharedKeyCredential } from "@azure/storage-blob";
5
4
  import { BinaryOperator, Clause } from "@esposter/azure";
6
5
  import { EventGridEvent, EventGridPublisherClient } from "@azure/eventgrid";
@@ -16,61 +15,6 @@ export declare const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windo
16
15
  export declare const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
17
16
  export declare const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
18
17
  //#endregion
19
- //#region src/models/MockResponse.d.ts
20
- export interface MockResponse {
21
- headers: HttpHeadersLike;
22
- parsedHeaders: Record<string, never>;
23
- request: WebResourceLike;
24
- status: number;
25
- }
26
- //#endregion
27
- //#region src/models/MockRestError.d.ts
28
- export declare class MockRestError extends RestError {
29
- constructor(message: string, statusCode: number);
30
- }
31
- //#endregion
32
- //#region src/models/PageSettings.d.ts
33
- /**
34
- * An interface that tracks the settings for paged iteration
35
- */
36
- export interface PageSettings {
37
- /**
38
- * The token that keeps track of where to continue the iterator
39
- */
40
- continuationToken?: string;
41
- /**
42
- * The size of the page during paged iteration
43
- */
44
- maxPageSize?: number;
45
- }
46
- //#endregion
47
- //#region src/models/PagedAsyncIterableIterator.d.ts
48
- /**
49
- * An interface that allows async iterable iteration both to completion and by page.
50
- */
51
- export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
52
- /**
53
- * The connection to the async iterator, part of the iteration protocol
54
- */
55
- [Symbol.asyncIterator]: () => PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
56
- /**
57
- * Return an AsyncIterableIterator that works a page at a time
58
- */
59
- byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;
60
- /**
61
- * The next method, part of the iteration protocol
62
- */
63
- next: () => Promise<IteratorResult<TElement>>;
64
- }
65
- //#endregion
66
- //#region src/services/createMockResponse.d.ts
67
- export declare const createMockResponse: (status: number, url?: string) => MockResponse;
68
- //#endregion
69
- //#region src/services/getMockSasUrl.d.ts
70
- export declare const getMockSasUrl: (url: string, permissions: undefined | {
71
- toString: () => string;
72
- }, resourceType?: string) => string;
73
- //#endregion
74
18
  //#region src/models/container/MockBlobDates.d.ts
75
19
  export interface MockBlobDates {
76
20
  createdOn: Date;
@@ -109,6 +53,9 @@ export type BlobHierarchyItem = (BlobItem & {
109
53
  kind: "prefix";
110
54
  });
111
55
  //#endregion
56
+ //#region src/util/types/MapValue.d.ts
57
+ export type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
58
+ //#endregion
112
59
  //#region src/models/container/MockBlobBatchClient.d.ts
113
60
  export declare class MockBlobBatchClient implements BlobBatchClient {
114
61
  #private;
@@ -124,7 +71,7 @@ export declare class MockBlobBatchClient implements BlobBatchClient {
124
71
  getContainer(containerName: string): MapValue<typeof MockContainerDatabase>;
125
72
  }
126
73
  //#endregion
127
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-any.d.ts
74
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-any.d.ts
128
75
  /**
129
76
  Returns a boolean for whether the given type is `any`.
130
77
 
@@ -155,7 +102,7 @@ const anyA = get(anyObject, 'a');
155
102
  */
156
103
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
157
104
  //#endregion
158
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-optional-key-of.d.ts
105
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-optional-key-of.d.ts
159
106
  /**
160
107
  Returns a boolean for whether the given key is an optional key of type.
161
108
 
@@ -198,7 +145,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
198
145
  */
199
146
  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;
200
147
  //#endregion
201
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/optional-keys-of.d.ts
148
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/optional-keys-of.d.ts
202
149
  /**
203
150
  Extract all optional keys from the given type.
204
151
 
@@ -236,7 +183,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
236
183
  ? (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`
237
184
  : never; // Should never happen
238
185
  //#endregion
239
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/required-keys-of.d.ts
186
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/required-keys-of.d.ts
240
187
  /**
241
188
  Extract all required keys from the given type.
242
189
 
@@ -270,7 +217,7 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
270
217
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
271
218
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
272
219
  //#endregion
273
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-never.d.ts
220
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-never.d.ts
274
221
  /**
275
222
  Returns a boolean for whether the given type is `never`.
276
223
 
@@ -326,7 +273,7 @@ type B = IsTrueFixed<never>;
326
273
  */
327
274
  type IsNever<T> = [T] extends [never] ? true : false;
328
275
  //#endregion
329
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/if.d.ts
276
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/if.d.ts
330
277
  /**
331
278
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
332
279
 
@@ -421,7 +368,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
421
368
  */
422
369
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
423
370
  //#endregion
424
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/simplify.d.ts
371
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/simplify.d.ts
425
372
  /**
426
373
  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.
427
374
 
@@ -482,7 +429,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
482
429
  */
483
430
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
484
431
  //#endregion
485
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/is-equal.d.ts
432
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-equal.d.ts
486
433
  /**
487
434
  Returns a boolean for whether the two given types are equal.
488
435
 
@@ -513,7 +460,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
513
460
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
514
461
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
515
462
  //#endregion
516
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/omit-index-signature.d.ts
463
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/omit-index-signature.d.ts
517
464
  /**
518
465
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
519
466
 
@@ -607,7 +554,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
607
554
  */
608
555
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
609
556
  //#endregion
610
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/pick-index-signature.d.ts
557
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/pick-index-signature.d.ts
611
558
  /**
612
559
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
613
560
 
@@ -655,7 +602,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
655
602
  */
656
603
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
657
604
  //#endregion
658
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/merge.d.ts
605
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/merge.d.ts
659
606
  // Merges two objects without worrying about index signatures.
660
607
  type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
661
608
  /**
@@ -726,7 +673,7 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
726
673
  : never; // Should never happen
727
674
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
728
675
  //#endregion
729
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/internal/object.d.ts
676
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/object.d.ts
730
677
  /**
731
678
  Merges user specified options with default options.
732
679
 
@@ -783,7 +730,7 @@ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<
783
730
  ) ? Result : never;
784
731
  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]; }>>>;
785
732
  //#endregion
786
- //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/except.d.ts
733
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/except.d.ts
787
734
  /**
788
735
  Filter out keys from an object.
789
736
 
@@ -940,6 +887,40 @@ export declare class MockBlockBlobClient extends MockBlobClient implements Excep
940
887
  uploadStream(): Promise<BlobUploadCommonResponse>;
941
888
  }
942
889
  //#endregion
890
+ //#region src/models/shared/PageSettings.d.ts
891
+ /**
892
+ * An interface that tracks the settings for paged iteration
893
+ */
894
+ export interface PageSettings {
895
+ /**
896
+ * The token that keeps track of where to continue the iterator
897
+ */
898
+ continuationToken?: string;
899
+ /**
900
+ * The size of the page during paged iteration
901
+ */
902
+ maxPageSize?: number;
903
+ }
904
+ //#endregion
905
+ //#region src/models/shared/PagedAsyncIterableIterator.d.ts
906
+ /**
907
+ * An interface that allows async iterable iteration both to completion and by page.
908
+ */
909
+ export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
910
+ /**
911
+ * The connection to the async iterator, part of the iteration protocol
912
+ */
913
+ [Symbol.asyncIterator]: () => PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
914
+ /**
915
+ * Return an AsyncIterableIterator that works a page at a time
916
+ */
917
+ byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;
918
+ /**
919
+ * The next method, part of the iteration protocol
920
+ */
921
+ next: () => Promise<IteratorResult<TElement>>;
922
+ }
923
+ //#endregion
943
924
  //#region src/models/container/MockContainerClient.d.ts
944
925
  /**
945
926
  * An in-memory mock of the Azure ContainerClient — no emulator and no network.
@@ -1091,6 +1072,19 @@ export declare class MockServiceBusSender implements ServiceBusSender {
1091
1072
  sendMessages(messages: ServiceBusMessage | ServiceBusMessage[] | ServiceBusMessageBatch): Promise<void>;
1092
1073
  }
1093
1074
  //#endregion
1075
+ //#region src/models/shared/MockResponse.d.ts
1076
+ export interface MockResponse {
1077
+ headers: HttpHeadersLike;
1078
+ parsedHeaders: Record<string, never>;
1079
+ request: WebResourceLike;
1080
+ status: number;
1081
+ }
1082
+ //#endregion
1083
+ //#region src/models/shared/MockRestError.d.ts
1084
+ export declare class MockRestError extends RestError {
1085
+ constructor(message: string, statusCode: number);
1086
+ }
1087
+ //#endregion
1094
1088
  //#region src/models/table/MockTableClient.d.ts
1095
1089
  /**
1096
1090
  * An in-memory mock of the Azure TableClient — no emulator and no network.
@@ -1223,6 +1217,14 @@ export declare const getMockQueueMessageItem: (messageText: string) => {
1223
1217
  messageText: string;
1224
1218
  };
1225
1219
  //#endregion
1220
+ //#region src/services/shared/createMockResponse.d.ts
1221
+ export declare const createMockResponse: (status: number, url?: string) => MockResponse;
1222
+ //#endregion
1223
+ //#region src/services/shared/getMockSasUrl.d.ts
1224
+ export declare const getMockSasUrl: (url: string, permissions: undefined | {
1225
+ toString: () => string;
1226
+ }, resourceType?: string) => string;
1227
+ //#endregion
1226
1228
  //#region src/services/table/compareByCompositeKey.d.ts
1227
1229
  export declare const compareByCompositeKey: (firstEntity: TableEntity, secondEntity: TableEntity) => number;
1228
1230
  //#endregion
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { RestError, createHttpHeaders, createPipelineRequest } from "@azure/core-rest-pipeline";
2
- import { toHttpHeadersLike } from "@azure/core-http-compat";
3
1
  import { ID_SEPARATOR, InvalidOperationError, Operation, chunk, exhaustiveGuard, getDecodedUriComponent, getOrCreate, getResult, html, noop, streamToText, takeOne } from "@esposter/shared";
2
+ import { toHttpHeadersLike } from "@azure/core-http-compat";
3
+ import { RestError, createHttpHeaders, createPipelineRequest } from "@azure/core-rest-pipeline";
4
4
  import { AnonymousCredential } from "@azure/storage-blob";
5
5
  import { Readable } from "node:stream";
6
6
  import { AZURE_MAX_PAGE_SIZE, AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS, BinaryOperator, deserializeClause, deserializeKey, getTableNullClause, serializeClauses } from "@esposter/azure";
@@ -13,52 +13,6 @@ const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
13
13
  const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
14
14
  const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
15
15
  //#endregion
16
- //#region src/models/MockRestError.ts
17
- var MockRestError = class extends RestError {
18
- constructor(message, statusCode) {
19
- super(message, { statusCode });
20
- this.name = "MockRestError";
21
- }
22
- };
23
- //#endregion
24
- //#region src/services/container/toWebResourceLike.ts
25
- const toWebResourceLike = (request) => ({
26
- abortSignal: request.abortSignal,
27
- agent: request.agent,
28
- body: request.body,
29
- clone: () => {
30
- throw new Error("Cannot clone a non-proxied WebResourceLike");
31
- },
32
- formData: request.formData,
33
- headers: toHttpHeadersLike(request.headers),
34
- keepAlive: request.disableKeepAlive,
35
- method: request.method,
36
- onDownloadProgress: request.onDownloadProgress,
37
- onUploadProgress: request.onUploadProgress,
38
- prepare: () => {
39
- throw new Error("WebResourceLike.prepare() is not supported by @azure/core-http-compat");
40
- },
41
- proxySettings: request.proxySettings,
42
- requestId: request.headers.get("x-ms-client-request-id") ?? request.requestId,
43
- requestOverrides: request.requestOverrides,
44
- streamResponseStatusCodes: request.streamResponseStatusCodes,
45
- timeout: request.timeout,
46
- url: request.url,
47
- validateRequestProperties: noop,
48
- withCredentials: request.withCredentials
49
- });
50
- //#endregion
51
- //#region src/services/createMockResponse.ts
52
- const createMockResponse = (status, url = "") => ({
53
- headers: toHttpHeadersLike(createHttpHeaders()),
54
- parsedHeaders: {},
55
- request: toWebResourceLike(createPipelineRequest({ url })),
56
- status
57
- });
58
- //#endregion
59
- //#region src/services/getMockSasUrl.ts
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
- //#endregion
62
16
  //#region src/store/MockContainerBlobDatesDatabase.ts
63
17
  const MockContainerBlobDatesDatabase = /* @__PURE__ */ new Map();
64
18
  //#endregion
@@ -137,6 +91,41 @@ const getBlobUrlParts = (url) => {
137
91
  };
138
92
  };
139
93
  //#endregion
94
+ //#region src/services/container/toWebResourceLike.ts
95
+ const toWebResourceLike = (request) => ({
96
+ abortSignal: request.abortSignal,
97
+ agent: request.agent,
98
+ body: request.body,
99
+ clone: () => {
100
+ throw new Error("Cannot clone a non-proxied WebResourceLike");
101
+ },
102
+ formData: request.formData,
103
+ headers: toHttpHeadersLike(request.headers),
104
+ keepAlive: request.disableKeepAlive,
105
+ method: request.method,
106
+ onDownloadProgress: request.onDownloadProgress,
107
+ onUploadProgress: request.onUploadProgress,
108
+ prepare: () => {
109
+ throw new Error("WebResourceLike.prepare() is not supported by @azure/core-http-compat");
110
+ },
111
+ proxySettings: request.proxySettings,
112
+ requestId: request.headers.get("x-ms-client-request-id") ?? request.requestId,
113
+ requestOverrides: request.requestOverrides,
114
+ streamResponseStatusCodes: request.streamResponseStatusCodes,
115
+ timeout: request.timeout,
116
+ url: request.url,
117
+ validateRequestProperties: noop,
118
+ withCredentials: request.withCredentials
119
+ });
120
+ //#endregion
121
+ //#region src/services/shared/createMockResponse.ts
122
+ const createMockResponse = (status, url = "") => ({
123
+ headers: toHttpHeadersLike(createHttpHeaders()),
124
+ parsedHeaders: {},
125
+ request: toWebResourceLike(createPipelineRequest({ url })),
126
+ status
127
+ });
128
+ //#endregion
140
129
  //#region src/models/container/MockBlobBatchClient.ts
141
130
  var MockBlobBatchClient = class {
142
131
  url;
@@ -208,6 +197,14 @@ var MockBlobBatchClient = class {
208
197
  }
209
198
  };
210
199
  //#endregion
200
+ //#region src/models/shared/MockRestError.ts
201
+ var MockRestError = class extends RestError {
202
+ constructor(message, statusCode) {
203
+ super(message, { statusCode });
204
+ this.name = "MockRestError";
205
+ }
206
+ };
207
+ //#endregion
211
208
  //#region src/services/container/getBlobUrl.ts
212
209
  const getBlobUrl = (containerName, blobName) => `${MOCK_BLOB_BASE_URL}/${containerName}/${blobName.split("/").map((segment) => encodeURIComponent(segment)).join("/")}`;
213
210
  //#endregion
@@ -233,6 +230,9 @@ const storeMockBlobWrite = (containerName, blobName, isExisting) => {
233
230
  });
234
231
  };
235
232
  //#endregion
233
+ //#region src/services/shared/getMockSasUrl.ts
234
+ 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"}`;
235
+ //#endregion
236
236
  //#region src/models/container/MockBlobClient.ts
237
237
  var MockBlobClient = class {
238
238
  connectionString;
@@ -841,26 +841,21 @@ var MockQueueClient = class {
841
841
  sendMessage(messageText, _options) {
842
842
  this.queue.push(messageText);
843
843
  const { expiresOn, insertedOn, messageId } = getMockQueueMessageItem(messageText);
844
- const nextVisibleOn = insertedOn;
845
- const popReceipt = crypto.randomUUID();
846
- const enqueuedMessages = [{
844
+ const enqueuedMessage = {
847
845
  expiresOn,
848
846
  insertedOn,
849
847
  messageId,
850
- nextVisibleOn,
851
- popReceipt
852
- }];
848
+ nextVisibleOn: insertedOn,
849
+ popReceipt: crypto.randomUUID()
850
+ };
851
+ const enqueuedMessages = [enqueuedMessage];
853
852
  return Promise.resolve({
854
853
  _response: {
855
854
  ...createMockResponse(200, this.url),
856
855
  bodyAsText: "",
857
856
  parsedBody: enqueuedMessages
858
857
  },
859
- expiresOn,
860
- insertedOn,
861
- messageId,
862
- nextVisibleOn,
863
- popReceipt
858
+ ...enqueuedMessage
864
859
  });
865
860
  }
866
861
  setAccessPolicy(_identifiers) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-mock",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "A library that contains azure mock classes.",
5
5
  "keywords": [
6
6
  "azure",
@@ -54,18 +54,18 @@
54
54
  "typecheck": "tsc"
55
55
  },
56
56
  "dependencies": {
57
- "@esposter/azure": "3.0.0",
58
- "@esposter/shared": "3.0.0",
57
+ "@esposter/azure": "3.2.0",
58
+ "@esposter/shared": "3.2.0",
59
59
  "fast-deep-equal": "^3.1.3"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@arethetypeswrong/core": "^0.18.5",
63
- "@esposter/configuration": "3.0.0",
63
+ "@esposter/configuration": "3.2.0",
64
64
  "publint": "^0.3.24",
65
65
  "tsdown": "^0.23.0",
66
- "type-fest": "^5.9.0",
66
+ "type-fest": "^5.10.0",
67
67
  "typedoc": "^0.28.20",
68
- "vitest": "^5.0.0"
68
+ "vitest": "^5.0.1"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@azure/core-http-compat": "^2.5.0",
@@ -78,7 +78,7 @@
78
78
  "@azure/storage-queue": "^12.31.0"
79
79
  },
80
80
  "inlinedDependencies": {
81
- "type-fest": "5.9.0"
81
+ "type-fest": "5.10.0"
82
82
  },
83
- "gitHead": "5ea72289bdd594e598aab8fefd5686df2a642a7e"
83
+ "gitHead": "bc055ed2f154eff219a355016a6b586962dbfa9c"
84
84
  }