azure-mock 2.38.0 → 2.38.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +161 -50
  2. package/dist/index.js +80 -53
  3. package/package.json +20 -9
package/dist/index.d.ts CHANGED
@@ -2,31 +2,38 @@ import { PipelineRequest, RestError } from "@azure/core-rest-pipeline";
2
2
  import { HttpHeadersLike, WebResourceLike } from "@azure/core-http-compat";
3
3
  import { MapValue } from "@esposter/shared";
4
4
  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
- import { BinaryOperator, Clause } from "@esposter/db-schema";
5
+ import { BinaryOperator, Clause } from "@esposter/azure";
6
6
  import { EventGridEvent, EventGridPublisherClient } from "@azure/eventgrid";
7
7
  import { ServiceBusMessage, ServiceBusMessageBatch, ServiceBusSender } from "@azure/service-bus";
8
8
  import { CreateTableEntityResponse, GetAccessPolicyResponse, GetTableEntityResponse, ListTableEntitiesOptions, TableClient, TableDeleteEntityHeaders, TableEntity, TableEntityResult, TableEntityResultPage, TableMergeEntityHeaders, TableSetAccessPolicyHeaders, TableTransactionResponse, UpdateMode } from "@azure/data-tables";
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
- export declare const BLOB_NOT_FOUND_ERROR_CODE = "BlobNotFound";
12
- export declare const BLOB_NOT_FOUND_MESSAGE = "The specified blob does not exist.";
13
- export declare const MOCK_BLOB_BASE_URL = "https://mockaccount.blob.core.windows.net";
14
- export declare const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
15
- export declare const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
16
- export declare const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
17
- export interface MockResponse {
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";
18
+ //#endregion
19
+ //#region src/models/MockResponse.d.ts
20
+ interface MockResponse {
18
21
  headers: HttpHeadersLike;
19
22
  parsedHeaders: Record<string, never>;
20
23
  request: WebResourceLike;
21
24
  status: number;
22
25
  }
23
- export declare class MockRestError extends RestError {
26
+ //#endregion
27
+ //#region src/models/MockRestError.d.ts
28
+ declare class MockRestError extends RestError {
24
29
  constructor(message: string, statusCode: number);
25
30
  }
31
+ //#endregion
32
+ //#region src/models/PageSettings.d.ts
26
33
  /**
27
34
  * An interface that tracks the settings for paged iteration
28
35
  */
29
- export interface PageSettings {
36
+ interface PageSettings {
30
37
  /**
31
38
  * The token that keeps track of where to continue the iterator
32
39
  */
@@ -36,10 +43,12 @@ export interface PageSettings {
36
43
  */
37
44
  maxPageSize?: number;
38
45
  }
46
+ //#endregion
47
+ //#region src/models/PagedAsyncIterableIterator.d.ts
39
48
  /**
40
49
  * An interface that allows async iterable iteration both to completion and by page.
41
50
  */
42
- export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
51
+ interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
43
52
  /**
44
53
  * The connection to the async iterator, part of the iteration protocol
45
54
  */
@@ -53,25 +62,47 @@ export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageS
53
62
  */
54
63
  next: () => Promise<IteratorResult<TElement>>;
55
64
  }
56
- export declare const createMockResponse: (status: number, url?: string) => MockResponse;
57
- export declare const getMockSasUrl: (url: string, permissions: undefined | {
65
+ //#endregion
66
+ //#region src/services/createMockResponse.d.ts
67
+ declare const createMockResponse: (status: number, url?: string) => MockResponse;
68
+ //#endregion
69
+ //#region src/services/getMockSasUrl.d.ts
70
+ declare const getMockSasUrl: (url: string, permissions: undefined | {
58
71
  toString: () => string;
59
72
  }, resourceType?: string) => string;
60
- export declare const MockContainerCreatedOnDatabase: Map<string, Date>;
61
- export declare const MOCK_BLOB_SEEDED_CREATED_ON: Date;
62
- export declare const getMockContainerCreatedOnKey: (containerName: string, blobName: string) => string;
63
- export declare const MockContainerDatabase: Map<string, Map<string, Buffer>>;
64
- export declare const MockEventGridDatabase: Map<string, EventGridEvent<unknown>[]>;
65
- export declare const MockQueueDatabase: Map<string, string[]>;
66
- export declare const MockSearchDatabase: Map<string, object[]>;
67
- export declare const MockServiceBusDatabase: Map<string, ServiceBusMessage[]>;
68
- export declare const MockTableDatabase: Map<string, Map<string, TableEntity>>;
69
- export type BlobHierarchyItem = (BlobItem & {
73
+ //#endregion
74
+ //#region src/store/MockContainerCreatedOnDatabase.d.ts
75
+ declare const MockContainerCreatedOnDatabase: Map<string, Date>;
76
+ declare const MOCK_BLOB_SEEDED_CREATED_ON: Date;
77
+ declare const getMockContainerCreatedOnKey: (containerName: string, blobName: string) => string;
78
+ //#endregion
79
+ //#region src/store/MockContainerDatabase.d.ts
80
+ declare const MockContainerDatabase: Map<string, Map<string, Buffer>>;
81
+ //#endregion
82
+ //#region src/store/MockEventGridDatabase.d.ts
83
+ declare const MockEventGridDatabase: Map<string, EventGridEvent<unknown>[]>;
84
+ //#endregion
85
+ //#region src/store/MockQueueDatabase.d.ts
86
+ declare const MockQueueDatabase: Map<string, string[]>;
87
+ //#endregion
88
+ //#region src/store/MockSearchDatabase.d.ts
89
+ declare const MockSearchDatabase: Map<string, object[]>;
90
+ //#endregion
91
+ //#region src/store/MockServiceBusDatabase.d.ts
92
+ declare const MockServiceBusDatabase: Map<string, ServiceBusMessage[]>;
93
+ //#endregion
94
+ //#region src/store/MockTableDatabase.d.ts
95
+ declare const MockTableDatabase: Map<string, Map<string, TableEntity>>;
96
+ //#endregion
97
+ //#region src/models/container/BlobHierarchyItem.d.ts
98
+ type BlobHierarchyItem = (BlobItem & {
70
99
  kind: "blob";
71
100
  }) | (BlobPrefix & {
72
101
  kind: "prefix";
73
102
  });
74
- export declare class MockBlobBatchClient implements BlobBatchClient {
103
+ //#endregion
104
+ //#region src/models/container/MockBlobBatchClient.d.ts
105
+ declare class MockBlobBatchClient implements BlobBatchClient {
75
106
  #private;
76
107
  url: string;
77
108
  constructor(url: string);
@@ -84,6 +115,8 @@ export declare class MockBlobBatchClient implements BlobBatchClient {
84
115
  deleteBlobs(urls: string[], credential: AnonymousCredential | StorageSharedKeyCredential, _options?: BlobDeleteOptions): Promise<BlobBatchDeleteBlobsResponse>;
85
116
  getContainer(containerName: string): MapValue<typeof MockContainerDatabase>;
86
117
  }
118
+ //#endregion
119
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-any.d.ts
87
120
  /**
88
121
  Returns a boolean for whether the given type is `any`.
89
122
 
@@ -113,6 +146,8 @@ const anyA = get(anyObject, 'a');
113
146
  @category Utilities
114
147
  */
115
148
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
149
+ //#endregion
150
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-optional-key-of.d.ts
116
151
  /**
117
152
  Returns a boolean for whether the given key is an optional key of type.
118
153
 
@@ -154,6 +189,8 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
154
189
  @category Utilities
155
190
  */
156
191
  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
+ //#endregion
193
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/optional-keys-of.d.ts
157
194
  /**
158
195
  Extract all optional keys from the given type.
159
196
 
@@ -190,6 +227,8 @@ const update2: UpdateOperation<User> = {
190
227
  type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
191
228
  ? (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`
192
229
  : never; // Should never happen
230
+ //#endregion
231
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/required-keys-of.d.ts
193
232
  /**
194
233
  Extract all required keys from the given type.
195
234
 
@@ -222,6 +261,8 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
222
261
  */
223
262
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
224
263
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
264
+ //#endregion
265
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-never.d.ts
225
266
  /**
226
267
  Returns a boolean for whether the given type is `never`.
227
268
 
@@ -276,6 +317,8 @@ type B = IsTrueFixed<never>;
276
317
  @category Utilities
277
318
  */
278
319
  type IsNever<T> = [T] extends [never] ? true : false;
320
+ //#endregion
321
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/if.d.ts
279
322
  /**
280
323
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
281
324
 
@@ -369,6 +412,8 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
369
412
  @category Utilities
370
413
  */
371
414
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
415
+ //#endregion
416
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/simplify.d.ts
372
417
  /**
373
418
  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.
374
419
 
@@ -428,6 +473,8 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
428
473
  @category Object
429
474
  */
430
475
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
476
+ //#endregion
477
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-equal.d.ts
431
478
  /**
432
479
  Returns a boolean for whether the two given types are equal.
433
480
 
@@ -457,6 +504,8 @@ type Includes<Value extends readonly any[], Item> =
457
504
  type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
458
505
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
459
506
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
507
+ //#endregion
508
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/omit-index-signature.d.ts
460
509
  /**
461
510
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
462
511
 
@@ -549,6 +598,8 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
549
598
  @category Object
550
599
  */
551
600
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
601
+ //#endregion
602
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/pick-index-signature.d.ts
552
603
  /**
553
604
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
554
605
 
@@ -595,6 +646,8 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
595
646
  @category Object
596
647
  */
597
648
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
649
+ //#endregion
650
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/merge.d.ts
598
651
  // Merges two objects without worrying about index signatures.
599
652
  type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
600
653
  /**
@@ -664,6 +717,8 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
664
717
  ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
665
718
  : never; // Should never happen
666
719
  type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
720
+ //#endregion
721
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/object.d.ts
667
722
  /**
668
723
  Merges user specified options with default options.
669
724
 
@@ -719,6 +774,8 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
719
774
  type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends (infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
720
775
  ) ? Result : never;
721
776
  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
+ //#endregion
778
+ //#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/except.d.ts
722
779
  /**
723
780
  Filter out keys from an object.
724
781
 
@@ -817,7 +874,9 @@ type PostPayloadFixed = Except<UserData, 'email'>;
817
874
  */
818
875
  type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
819
876
  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>> : {});
820
- export declare class MockBlobClient implements Except<BlobClient, "accountName"> {
877
+ //#endregion
878
+ //#region src/models/container/MockBlobClient.d.ts
879
+ declare class MockBlobClient implements Except<BlobClient, "accountName"> {
821
880
  connectionString: string;
822
881
  containerName: string;
823
882
  credential: AnonymousCredential;
@@ -857,7 +916,9 @@ export declare class MockBlobClient implements Except<BlobClient, "accountName">
857
916
  withSnapshot(): BlockBlobClient;
858
917
  withVersion(): BlobClient;
859
918
  }
860
- export declare class MockBlockBlobClient extends MockBlobClient implements Except<BlockBlobClient, "accountName"> {
919
+ //#endregion
920
+ //#region src/models/container/MockBlockBlobClient.d.ts
921
+ declare class MockBlockBlobClient extends MockBlobClient implements Except<BlockBlobClient, "accountName"> {
861
922
  commitBlockList(): Promise<BlockBlobCommitBlockListResponse>;
862
923
  getBlockList(): Promise<BlockBlobGetBlockListResponse>;
863
924
  query(): Promise<BlobDownloadResponseModel>;
@@ -870,6 +931,8 @@ export declare class MockBlockBlobClient extends MockBlobClient implements Excep
870
931
  uploadFile(): Promise<BlobUploadCommonResponse>;
871
932
  uploadStream(): Promise<BlobUploadCommonResponse>;
872
933
  }
934
+ //#endregion
935
+ //#region src/models/container/MockContainerClient.d.ts
873
936
  /**
874
937
  * An in-memory mock of the Azure ContainerClient — no emulator and no network.
875
938
  *
@@ -879,7 +942,7 @@ export declare class MockBlockBlobClient extends MockBlobClient implements Excep
879
942
  * await blockBlobClient.upload("hello world", 11);
880
943
  * const content = await blockBlobClient.downloadToBuffer();
881
944
  */
882
- export declare class MockContainerClient implements Except<ContainerClient, "accountName"> {
945
+ declare class MockContainerClient implements Except<ContainerClient, "accountName"> {
883
946
  #private;
884
947
  connectionString: string;
885
948
  containerName: string;
@@ -916,17 +979,21 @@ export declare class MockContainerClient implements Except<ContainerClient, "acc
916
979
  response: BlockBlobUploadResponse;
917
980
  }>;
918
981
  }
982
+ //#endregion
983
+ //#region src/models/eventGrid/MockEventGridPublisherClient.d.ts
919
984
  /**
920
985
  * An in-memory mock of the Azure EventGridPublisherClient — no emulator and no network.
921
986
  * `client` is excluded because it is a private member of the real class and cannot be satisfied structurally.
922
987
  */
923
- export declare class MockEventGridPublisherClient implements Except<EventGridPublisherClient<"EventGrid">, "apiVersion"> {
988
+ declare class MockEventGridPublisherClient implements Except<EventGridPublisherClient<"EventGrid">, "apiVersion"> {
924
989
  readonly endpointUrl: string;
925
990
  readonly inputSchema: "EventGrid";
926
991
  readonly topicType: "EventGrid";
927
992
  constructor(endpoint: string, topicType: "EventGrid");
928
993
  send(newEvents: EventGridEvent<unknown>[]): Promise<void>;
929
994
  }
995
+ //#endregion
996
+ //#region src/models/queue/MockQueueClient.d.ts
930
997
  /**
931
998
  * An in-memory mock of the Azure QueueClient — no emulator and no network.
932
999
  *
@@ -936,7 +1003,7 @@ export declare class MockEventGridPublisherClient implements Except<EventGridPub
936
1003
  * await mockQueueClient.sendMessage("hello world");
937
1004
  * const messages = await mockQueueClient.peekMessages();
938
1005
  */
939
- export declare class MockQueueClient implements Except<QueueClient, "accountName"> {
1006
+ declare class MockQueueClient implements Except<QueueClient, "accountName"> {
940
1007
  connectionString: string;
941
1008
  name: string;
942
1009
  url: string;
@@ -964,6 +1031,8 @@ export declare class MockQueueClient implements Except<QueueClient, "accountName
964
1031
  setMetadata(): Promise<QueueSetMetadataResponse>;
965
1032
  updateMessage(): Promise<QueueUpdateMessageResponse>;
966
1033
  }
1034
+ //#endregion
1035
+ //#region src/models/search/MockSearchClient.d.ts
967
1036
  /**
968
1037
  * An in-memory mock of the Azure SearchClient — no emulator and no network. It applies the same OData filtering
969
1038
  * as the other mock clients, so a query behaves the same here as it does against the service.
@@ -973,7 +1042,7 @@ export declare class MockQueueClient implements Except<QueueClient, "accountName
973
1042
  * await mockSearchClient.uploadDocuments([{ ... }]);
974
1043
  * const { count, results } = await mockSearchClient.search("*", { filter, includeTotalCount: true });
975
1044
  */
976
- export declare class MockSearchClient<TModel extends object = Record<string, unknown>> implements Except<SearchClient<TModel>, "pipeline"> {
1045
+ declare class MockSearchClient<TModel extends object = Record<string, unknown>> implements Except<SearchClient<TModel>, "pipeline"> {
977
1046
  readonly apiVersion: string;
978
1047
  readonly endpoint: string;
979
1048
  readonly indexName: string;
@@ -992,6 +1061,8 @@ export declare class MockSearchClient<TModel extends object = Record<string, unk
992
1061
  suggest<TFields extends SelectFields<TModel> = never>(_searchText: string, _suggesterName: string, _options?: SuggestOptions<TModel, TFields>): Promise<SuggestDocumentsResult<TModel, TFields>>;
993
1062
  uploadDocuments(documents: TModel[], _options?: UploadDocumentsOptions): Promise<IndexDocumentsResult>;
994
1063
  }
1064
+ //#endregion
1065
+ //#region src/models/serviceBus/MockServiceBusSender.d.ts
995
1066
  /**
996
1067
  * An in-memory mock of the Azure ServiceBusSender — no emulator and no network.
997
1068
  *
@@ -999,7 +1070,7 @@ export declare class MockSearchClient<TModel extends object = Record<string, unk
999
1070
  * const mockServiceBusSender = new MockServiceBusSender("hello world");
1000
1071
  * await mockServiceBusSender.scheduleMessages({ body: "hello world" }, new Date());
1001
1072
  */
1002
- export declare class MockServiceBusSender implements ServiceBusSender {
1073
+ declare class MockServiceBusSender implements ServiceBusSender {
1003
1074
  entityPath: string;
1004
1075
  identifier: string;
1005
1076
  isClosed: boolean;
@@ -1011,6 +1082,8 @@ export declare class MockServiceBusSender implements ServiceBusSender {
1011
1082
  scheduleMessages(messages: ServiceBusMessage | ServiceBusMessage[], scheduledEnqueueTimeUtc: Date): Promise<never[]>;
1012
1083
  sendMessages(messages: ServiceBusMessage | ServiceBusMessage[] | ServiceBusMessageBatch): Promise<void>;
1013
1084
  }
1085
+ //#endregion
1086
+ //#region src/models/table/MockTableClient.d.ts
1014
1087
  /**
1015
1088
  * An in-memory mock of the Azure TableClient — no emulator and no network.
1016
1089
  *
@@ -1019,7 +1092,7 @@ export declare class MockServiceBusSender implements ServiceBusSender {
1019
1092
  * await mockTableClient.createEntity({ partitionKey: "partitionKey", rowKey: "rowKey" });
1020
1093
  * const entity = await mockTableClient.getEntity("partitionKey", "rowKey");
1021
1094
  */
1022
- export declare class MockTableClient<TEntity extends TableEntity = TableEntity> implements Except<TableClient, "pipeline"> {
1095
+ declare class MockTableClient<TEntity extends TableEntity = TableEntity> implements Except<TableClient, "pipeline"> {
1023
1096
  #private;
1024
1097
  entityType: TEntity;
1025
1098
  tableName: string;
@@ -1040,49 +1113,87 @@ export declare class MockTableClient<TEntity extends TableEntity = TableEntity>
1040
1113
  }): Promise<TableMergeEntityHeaders>;
1041
1114
  upsertEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode): Promise<TableMergeEntityHeaders>;
1042
1115
  }
1116
+ //#endregion
1117
+ //#region src/models/webPubSub/MockWebPubSubServiceClient.d.ts
1043
1118
  /**
1044
1119
  * A minimal mock of the Azure WebPubSubServiceClient for testing purposes.
1045
1120
  * Only implements `group().sendToAll` — the only method used in azure-functions tests.
1046
1121
  */
1047
- export declare class MockWebPubSubServiceClient {
1122
+ declare class MockWebPubSubServiceClient {
1048
1123
  group(_groupName: string): {
1049
1124
  sendToAll: () => Promise<void>;
1050
1125
  };
1051
1126
  }
1052
- export declare const bodyToBuffer: (body: HttpRequestBody) => Promise<Buffer>;
1127
+ //#endregion
1128
+ //#region src/services/container/bodyToBuffer.d.ts
1129
+ declare const bodyToBuffer: (body: HttpRequestBody) => Promise<Buffer>;
1130
+ //#endregion
1131
+ //#region src/services/container/getAzureErrorXml.d.ts
1053
1132
  /**
1054
1133
  * Generates a standard Azure Storage error XML response body.
1055
1134
  * @param errorCode The official Azure error code (e.g., "BlobNotFound").
1056
1135
  * @param errorMessage The user-friendly error message.
1057
1136
  * @returns A formatted XML string.
1058
1137
  */
1059
- export declare const getAzureErrorXml: (errorCode: string, errorMessage: string) => string;
1060
- export declare const getBlobItemXml: ({ name, properties }: BlobItem) => string;
1061
- export declare const getBlobPrefixXml: (name: string) => string;
1062
- export declare const getBlobUrl: (containerName: string, blobName: string) => string;
1063
- export declare const getBlobUrlParts: (url: string) => undefined | {
1138
+ declare const getAzureErrorXml: (errorCode: string, errorMessage: string) => string;
1139
+ //#endregion
1140
+ //#region src/services/container/getBlobItemXml.d.ts
1141
+ declare const getBlobItemXml: ({ name, properties }: BlobItem) => string;
1142
+ //#endregion
1143
+ //#region src/services/container/getBlobPrefixXml.d.ts
1144
+ declare const getBlobPrefixXml: (name: string) => string;
1145
+ //#endregion
1146
+ //#region src/services/container/getBlobUrl.d.ts
1147
+ declare const getBlobUrl: (containerName: string, blobName: string) => string;
1148
+ //#endregion
1149
+ //#region src/services/container/getBlobUrlParts.d.ts
1150
+ declare const getBlobUrlParts: (url: string) => undefined | {
1064
1151
  blobName: string;
1065
1152
  containerName: string;
1066
1153
  };
1067
- export declare const getListBlobsSegmentResponse: (containerName: string, prefix: string, segment: BlobHierarchyListSegment, blobsXml: string) => ContainerListBlobHierarchySegmentResponse;
1154
+ //#endregion
1155
+ //#region src/services/container/getListBlobsSegmentResponse.d.ts
1156
+ declare const getListBlobsSegmentResponse: (containerName: string, prefix: string, segment: BlobHierarchyListSegment, blobsXml: string) => ContainerListBlobHierarchySegmentResponse;
1157
+ //#endregion
1158
+ //#region src/services/container/getListBlobsXml.d.ts
1068
1159
  /**
1069
1160
  * Generates a standard Azure Storage list blobs XML response body.
1070
1161
  * @param containerName The container name.
1071
1162
  * @param blobsXml The blobs xml data.
1072
1163
  * @returns A formatted XML string.
1073
1164
  */
1074
- export declare const getListBlobsXml: (containerName: string, blobsXml: string) => string;
1075
- export declare const getMockContainer: (containerName: string) => MapValue<typeof MockContainerDatabase>;
1076
- export declare const isReadableStream: (value: unknown) => value is NodeJS.ReadableStream;
1077
- export declare const toWebResourceLike: (request: PipelineRequest) => WebResourceLike;
1078
- export declare const applyFilter: <T extends Record<string, unknown>>(documents: T[], clauses: Clause<T>[]) => T[];
1079
- export declare const compare: <T>(operator: BinaryOperator, leftHandSide: T, rightHandSide: null | T) => boolean;
1080
- export declare const createFilterPredicate: (filter: string) => ((document: Record<string, unknown>) => boolean);
1081
- export declare const isNullClause: (clause: Clause<Record<string, unknown>>) => boolean;
1082
- export declare const getMockQueueMessageItem: (messageText: string) => {
1165
+ declare const getListBlobsXml: (containerName: string, blobsXml: string) => string;
1166
+ //#endregion
1167
+ //#region src/services/container/getMockContainer.d.ts
1168
+ declare const getMockContainer: (containerName: string) => MapValue<typeof MockContainerDatabase>;
1169
+ //#endregion
1170
+ //#region src/services/container/isReadableStream.d.ts
1171
+ declare const isReadableStream: (value: unknown) => value is NodeJS.ReadableStream;
1172
+ //#endregion
1173
+ //#region src/services/container/toWebResourceLike.d.ts
1174
+ declare const toWebResourceLike: (request: PipelineRequest) => WebResourceLike;
1175
+ //#endregion
1176
+ //#region src/services/filter/applyFilter.d.ts
1177
+ declare const applyFilter: <T extends Record<string, unknown>>(documents: T[], clauses: Clause<T>[]) => T[];
1178
+ //#endregion
1179
+ //#region src/services/filter/compare.d.ts
1180
+ declare const compare: <T>(operator: BinaryOperator, leftHandSide: T, rightHandSide: null | T) => boolean;
1181
+ //#endregion
1182
+ //#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;
1187
+ //#endregion
1188
+ //#region src/services/queue/getMockQueueMessageItem.d.ts
1189
+ declare const getMockQueueMessageItem: (messageText: string) => {
1083
1190
  expiresOn: Date;
1084
1191
  insertedOn: Date;
1085
1192
  messageId: string;
1086
1193
  messageText: string;
1087
1194
  };
1088
- export declare const compareByCompositeKey: (a: TableEntity, b: TableEntity) => number;
1195
+ //#endregion
1196
+ //#region src/services/table/compareByCompositeKey.d.ts
1197
+ declare const compareByCompositeKey: (a: TableEntity, b: TableEntity) => number;
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 };
package/dist/index.js CHANGED
@@ -3,41 +3,25 @@ import { toHttpHeadersLike } from "@azure/core-http-compat";
3
3
  import { ID_SEPARATOR, InvalidOperationError, Operation, chunk, exhaustiveGuard, getDecodedUriComponent, getOrCreate, getResult, html, noop, streamToText, takeOne } from "@esposter/shared";
4
4
  import { AnonymousCredential } from "@azure/storage-blob";
5
5
  import { Readable } from "node:stream";
6
- import { MAX_QUEUE_VISIBILITY_TIMEOUT_MS, deserializeClause, deserializeKey, getTableNullClause, serializeClauses } from "@esposter/db";
7
- import { AZURE_MAX_PAGE_SIZE, BinaryOperator } from "@esposter/db-schema";
8
- var __create = Object.create;
9
- var __defProp = Object.defineProperty;
10
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
- var __getOwnPropNames = Object.getOwnPropertyNames;
12
- var __getProtoOf = Object.getPrototypeOf;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
17
- key = keys[i];
18
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
- get: ((k) => from[k]).bind(null, key),
20
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
- });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: true
28
- }) : target, mod));
6
+ import { AZURE_MAX_PAGE_SIZE, AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS, BinaryOperator, deserializeClause, deserializeKey, getTableNullClause, serializeClauses } from "@esposter/azure";
7
+ import deepEqual from "fast-deep-equal";
8
+ //#region src/constants.ts
29
9
  const BLOB_NOT_FOUND_ERROR_CODE = "BlobNotFound";
30
10
  const BLOB_NOT_FOUND_MESSAGE = "The specified blob does not exist.";
31
11
  const MOCK_BLOB_BASE_URL = "https://mockaccount.blob.core.windows.net";
32
12
  const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
33
13
  const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
34
14
  const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
15
+ //#endregion
16
+ //#region src/models/MockRestError.ts
35
17
  var MockRestError = class extends RestError {
36
18
  constructor(message, statusCode) {
37
19
  super(message, { statusCode });
38
20
  this.name = "MockRestError";
39
21
  }
40
22
  };
23
+ //#endregion
24
+ //#region src/services/container/toWebResourceLike.ts
41
25
  const toWebResourceLike = (request) => ({
42
26
  abortSignal: request.abortSignal,
43
27
  agent: request.agent,
@@ -63,16 +47,24 @@ const toWebResourceLike = (request) => ({
63
47
  validateRequestProperties: noop,
64
48
  withCredentials: request.withCredentials
65
49
  });
50
+ //#endregion
51
+ //#region src/services/createMockResponse.ts
66
52
  const createMockResponse = (status, url = "") => ({
67
53
  headers: toHttpHeadersLike(createHttpHeaders()),
68
54
  parsedHeaders: {},
69
55
  request: toWebResourceLike(createPipelineRequest({ url })),
70
56
  status
71
57
  });
58
+ //#endregion
59
+ //#region src/services/getMockSasUrl.ts
72
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
+ //#region src/store/MockContainerCreatedOnDatabase.ts
73
63
  const MockContainerCreatedOnDatabase = /* @__PURE__ */ new Map();
74
64
  const MOCK_BLOB_SEEDED_CREATED_ON = /* @__PURE__ */ new Date(-864e13);
75
65
  const getMockContainerCreatedOnKey = (containerName, blobName) => `${containerName}/${blobName}`;
66
+ //#endregion
67
+ //#region src/store/MockContainerDatabase.ts
76
68
  var MockContainerDatabaseMap = class extends Map {
77
69
  clear() {
78
70
  super.clear();
@@ -80,11 +72,23 @@ var MockContainerDatabaseMap = class extends Map {
80
72
  }
81
73
  };
82
74
  const MockContainerDatabase = new MockContainerDatabaseMap();
75
+ //#endregion
76
+ //#region src/store/MockEventGridDatabase.ts
83
77
  const MockEventGridDatabase = /* @__PURE__ */ new Map();
78
+ //#endregion
79
+ //#region src/store/MockQueueDatabase.ts
84
80
  const MockQueueDatabase = /* @__PURE__ */ new Map();
81
+ //#endregion
82
+ //#region src/store/MockSearchDatabase.ts
85
83
  const MockSearchDatabase = /* @__PURE__ */ new Map();
84
+ //#endregion
85
+ //#region src/store/MockServiceBusDatabase.ts
86
86
  const MockServiceBusDatabase = /* @__PURE__ */ new Map();
87
+ //#endregion
88
+ //#region src/store/MockTableDatabase.ts
87
89
  const MockTableDatabase = /* @__PURE__ */ new Map();
90
+ //#endregion
91
+ //#region src/services/container/getAzureErrorXml.ts
88
92
  /**
89
93
  * Generates a standard Azure Storage error XML response body.
90
94
  * @param errorCode The official Azure error code (e.g., "BlobNotFound").
@@ -96,6 +100,8 @@ const getAzureErrorXml = (errorCode, errorMessage) => html`<?xml version="1.0" e
96
100
  <code>${errorCode}</code>
97
101
  <Message>${errorMessage}</Message>
98
102
  </Error>`;
103
+ //#endregion
104
+ //#region src/services/container/getBlobUrlParts.ts
99
105
  const decodeSegment = (segment) => getDecodedUriComponent(segment, segment);
100
106
  const getBlobUrlParts = (url) => {
101
107
  const parsedUrl = getResult(() => new URL(url)).unwrapOr(void 0);
@@ -107,7 +113,11 @@ const getBlobUrlParts = (url) => {
107
113
  containerName: decodeSegment(takeOne(pathSegments))
108
114
  };
109
115
  };
116
+ //#endregion
117
+ //#region src/services/container/getMockContainer.ts
110
118
  const getMockContainer = (containerName) => getOrCreate(MockContainerDatabase, containerName, () => /* @__PURE__ */ new Map());
119
+ //#endregion
120
+ //#region src/models/container/MockBlobBatchClient.ts
111
121
  var MockBlobBatchClient = class {
112
122
  url;
113
123
  constructor(url) {
@@ -180,7 +190,11 @@ var MockBlobBatchClient = class {
180
190
  };
181
191
  }
182
192
  };
193
+ //#endregion
194
+ //#region src/services/container/getBlobUrl.ts
183
195
  const getBlobUrl = (containerName, blobName) => `${MOCK_BLOB_BASE_URL}/${containerName}/${blobName.split("/").map((segment) => encodeURIComponent(segment)).join("/")}`;
196
+ //#endregion
197
+ //#region src/models/container/MockBlobClient.ts
184
198
  var MockBlobClient = class {
185
199
  connectionString;
186
200
  containerName;
@@ -336,7 +350,11 @@ var MockBlobClient = class {
336
350
  throw new Error("Method not implemented.");
337
351
  }
338
352
  };
353
+ //#endregion
354
+ //#region src/services/container/isReadableStream.ts
339
355
  const isReadableStream = (value) => value instanceof Readable;
356
+ //#endregion
357
+ //#region src/services/container/bodyToBuffer.ts
340
358
  const bodyToBuffer = async (body) => {
341
359
  if (body === null) return Buffer.alloc(0);
342
360
  else if (typeof body === "string") return Buffer.from(body);
@@ -364,6 +382,8 @@ const bodyToBuffer = async (body) => {
364
382
  return Buffer.alloc(0);
365
383
  }
366
384
  };
385
+ //#endregion
386
+ //#region src/models/container/MockBlockBlobClient.ts
367
387
  var MockBlockBlobClient = class extends MockBlobClient {
368
388
  commitBlockList() {
369
389
  throw new Error("Method not implemented.");
@@ -403,6 +423,8 @@ var MockBlockBlobClient = class extends MockBlobClient {
403
423
  throw new Error("Method not implemented.");
404
424
  }
405
425
  };
426
+ //#endregion
427
+ //#region src/services/container/getBlobItemXml.ts
406
428
  const getBlobItemXml = ({ name, properties }) => html`<Blob>
407
429
  <Name>${name}</Name>
408
430
  <Properties>
@@ -415,7 +437,11 @@ const getBlobItemXml = ({ name, properties }) => html`<Blob>
415
437
  <LeaseState>available</LeaseState>
416
438
  </Properties>
417
439
  </Blob>`;
440
+ //#endregion
441
+ //#region src/services/container/getBlobPrefixXml.ts
418
442
  const getBlobPrefixXml = (name) => html`<BlobPrefix><Name>${name}</Name></BlobPrefix>`;
443
+ //#endregion
444
+ //#region src/services/container/getListBlobsXml.ts
419
445
  /**
420
446
  * Generates a standard Azure Storage list blobs XML response body.
421
447
  * @param containerName The container name.
@@ -427,6 +453,8 @@ const getListBlobsXml = (containerName, blobsXml) => html`<?xml version="1.0" en
427
453
  <Blobs>${blobsXml}</Blobs>
428
454
  <NextMarker />
429
455
  </EnumerationResults>`;
456
+ //#endregion
457
+ //#region src/services/container/getListBlobsSegmentResponse.ts
430
458
  const getListBlobsSegmentResponse = (containerName, prefix, segment, blobsXml) => {
431
459
  const segmentResponse = {
432
460
  containerName,
@@ -444,6 +472,8 @@ const getListBlobsSegmentResponse = (containerName, prefix, segment, blobsXml) =
444
472
  ...segmentResponse
445
473
  };
446
474
  };
475
+ //#endregion
476
+ //#region src/models/container/MockContainerClient.ts
447
477
  /**
448
478
  * An in-memory mock of the Azure ContainerClient — no emulator and no network.
449
479
  *
@@ -634,6 +664,8 @@ var MockContainerClient = class {
634
664
  }
635
665
  }
636
666
  };
667
+ //#endregion
668
+ //#region src/models/eventGrid/MockEventGridPublisherClient.ts
637
669
  /**
638
670
  * An in-memory mock of the Azure EventGridPublisherClient — no emulator and no network.
639
671
  * `client` is excluded because it is a private member of the real class and cannot be satisfied structurally.
@@ -652,15 +684,19 @@ var MockEventGridPublisherClient = class {
652
684
  return Promise.resolve();
653
685
  }
654
686
  };
687
+ //#endregion
688
+ //#region src/services/queue/getMockQueueMessageItem.ts
655
689
  const getMockQueueMessageItem = (messageText) => {
656
690
  const insertedOn = /* @__PURE__ */ new Date();
657
691
  return {
658
- expiresOn: new Date(insertedOn.getTime() + MAX_QUEUE_VISIBILITY_TIMEOUT_MS),
692
+ expiresOn: new Date(insertedOn.getTime() + AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS),
659
693
  insertedOn,
660
694
  messageId: crypto.randomUUID(),
661
695
  messageText
662
696
  };
663
697
  };
698
+ //#endregion
699
+ //#region src/models/queue/MockQueueClient.ts
664
700
  /**
665
701
  * An in-memory mock of the Azure QueueClient — no emulator and no network.
666
702
  *
@@ -793,6 +829,8 @@ var MockQueueClient = class {
793
829
  throw new Error("Method not implemented.");
794
830
  }
795
831
  };
832
+ //#endregion
833
+ //#region src/services/filter/compare.ts
796
834
  const compare = (operator, leftHandSide, rightHandSide) => {
797
835
  if (rightHandSide === null || rightHandSide === void 0) {
798
836
  if (operator !== BinaryOperator.eq) throw new InvalidOperationError(Operation.Read, compare.name, JSON.stringify({
@@ -812,38 +850,14 @@ const compare = (operator, leftHandSide, rightHandSide) => {
812
850
  default: return exhaustiveGuard(operator);
813
851
  }
814
852
  };
815
- var import_fast_deep_equal = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
816
- module.exports = function equal(a, b) {
817
- if (a === b) return true;
818
- if (a && b && typeof a == "object" && typeof b == "object") {
819
- if (a.constructor !== b.constructor) return false;
820
- var length, i, keys;
821
- if (Array.isArray(a)) {
822
- length = a.length;
823
- if (length != b.length) return false;
824
- for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
825
- return true;
826
- }
827
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
828
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
829
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
830
- keys = Object.keys(a);
831
- length = keys.length;
832
- if (length !== Object.keys(b).length) return false;
833
- for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
834
- for (i = length; i-- !== 0;) {
835
- var key = keys[i];
836
- if (!equal(a[key], b[key])) return false;
837
- }
838
- return true;
839
- }
840
- return a !== a && b !== b;
841
- };
842
- })))(), 1);
853
+ //#endregion
854
+ //#region src/services/filter/isNullClause.ts
843
855
  const isNullClause = (clause) => {
844
856
  const tableNullClause = getTableNullClause(clause.key);
845
- return (0, import_fast_deep_equal.default)(clause, tableNullClause);
857
+ return deepEqual(clause, tableNullClause);
846
858
  };
859
+ //#endregion
860
+ //#region src/services/filter/createFilterPredicate.ts
847
861
  const createFilterPredicate = (filter) => {
848
862
  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) => {
849
863
  const clause = deserializeClause(clauseString);
@@ -873,6 +887,8 @@ const createFilterPredicate = (filter) => {
873
887
  return true;
874
888
  };
875
889
  };
890
+ //#endregion
891
+ //#region src/models/search/MockSearchClient.ts
876
892
  const toComparable = (value) => {
877
893
  if (value instanceof Date) return value.getTime();
878
894
  else if (typeof value === "number" || typeof value === "string") return value;
@@ -980,6 +996,8 @@ var MockSearchClient = class {
980
996
  return Promise.resolve({ results: [] });
981
997
  }
982
998
  };
999
+ //#endregion
1000
+ //#region src/models/serviceBus/MockServiceBusSender.ts
983
1001
  /**
984
1002
  * An in-memory mock of the Azure ServiceBusSender — no emulator and no network.
985
1003
  *
@@ -1021,11 +1039,15 @@ var MockServiceBusSender = class {
1021
1039
  return Promise.resolve();
1022
1040
  }
1023
1041
  };
1042
+ //#endregion
1043
+ //#region src/services/table/compareByCompositeKey.ts
1024
1044
  const compareByCompositeKey = (a, b) => {
1025
1045
  if (a.partitionKey !== b.partitionKey) return a.partitionKey < b.partitionKey ? -1 : 1;
1026
1046
  else if (a.rowKey === b.rowKey) return 0;
1027
1047
  else return a.rowKey < b.rowKey ? -1 : 1;
1028
1048
  };
1049
+ //#endregion
1050
+ //#region src/models/table/MockTableClient.ts
1029
1051
  /**
1030
1052
  * An in-memory mock of the Azure TableClient — no emulator and no network.
1031
1053
  *
@@ -1203,6 +1225,8 @@ var MockTableClient = class {
1203
1225
  };
1204
1226
  }
1205
1227
  };
1228
+ //#endregion
1229
+ //#region src/models/webPubSub/MockWebPubSubServiceClient.ts
1206
1230
  /**
1207
1231
  * A minimal mock of the Azure WebPubSubServiceClient for testing purposes.
1208
1232
  * Only implements `group().sendToAll` — the only method used in azure-functions tests.
@@ -1212,8 +1236,11 @@ var MockWebPubSubServiceClient = class {
1212
1236
  return { sendToAll: () => Promise.resolve() };
1213
1237
  }
1214
1238
  };
1239
+ //#endregion
1240
+ //#region src/services/filter/applyFilter.ts
1215
1241
  const applyFilter = (documents, clauses) => {
1216
1242
  const predicate = createFilterPredicate(serializeClauses(clauses));
1217
1243
  return documents.filter((document) => predicate(document));
1218
1244
  };
1245
+ //#endregion
1219
1246
  export { BLOB_NOT_FOUND_ERROR_CODE, BLOB_NOT_FOUND_MESSAGE, 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, MockRestError, MockSearchClient, MockSearchDatabase, MockServiceBusDatabase, MockServiceBusSender, MockTableClient, MockTableDatabase, MockWebPubSubServiceClient, applyFilter, bodyToBuffer, compare, compareByCompositeKey, createFilterPredicate, createMockResponse, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, getBlobUrl, getBlobUrlParts, getListBlobsSegmentResponse, getListBlobsXml, getMockContainer, getMockContainerCreatedOnKey, getMockQueueMessageItem, getMockSasUrl, isNullClause, isReadableStream, toWebResourceLike };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-mock",
3
- "version": "2.38.0",
3
+ "version": "2.38.1",
4
4
  "description": "A library that contains azure mock classes.",
5
5
  "keywords": [
6
6
  "azure",
@@ -31,13 +31,20 @@
31
31
  "dist"
32
32
  ],
33
33
  "type": "module",
34
- "main": "dist/index.js",
34
+ "sideEffects": false,
35
35
  "types": "dist/index.d.ts",
36
+ "imports": {
37
+ "#src/*": "./src/*.ts"
38
+ },
39
+ "exports": {
40
+ ".": "./dist/index.js",
41
+ "./package.json": "./package.json"
42
+ },
36
43
  "publishConfig": {
37
44
  "access": "public"
38
45
  },
39
46
  "scripts": {
40
- "build": "pnpm export:gen && rolldown --config rolldown.config.ts",
47
+ "build": "pnpm export:gen && tsdown",
41
48
  "export:gen": "ctix build --config ../configuration/.ctirc-ts",
42
49
  "format": "oxfmt",
43
50
  "format:check": "oxfmt --check",
@@ -47,15 +54,16 @@
47
54
  "typecheck": "tsgo"
48
55
  },
49
56
  "dependencies": {
50
- "@esposter/db": "2.38.0",
51
- "@esposter/db-schema": "2.38.0",
52
- "@esposter/shared": "2.38.0",
57
+ "@esposter/azure": "2.38.1",
58
+ "@esposter/shared": "2.38.1",
53
59
  "fast-deep-equal": "^3.1.3"
54
60
  },
55
61
  "devDependencies": {
56
- "@esposter/configuration": "2.38.0",
62
+ "@arethetypeswrong/core": "^0.18.5",
63
+ "@esposter/configuration": "2.38.1",
57
64
  "ctix": "^2.8.2",
58
- "rolldown": "^1.2.5",
65
+ "publint": "^0.3.24",
66
+ "tsdown": "^0.22.14",
59
67
  "type-fest": "^5.8.0",
60
68
  "typedoc": "^0.28.20",
61
69
  "vitest": "^4.1.11"
@@ -70,5 +78,8 @@
70
78
  "@azure/storage-blob": "^12.33.0",
71
79
  "@azure/storage-queue": "^12.31.0"
72
80
  },
73
- "gitHead": "41f54a9cc8f41c4c1d2ee1fa3214d144ee52c4ad"
81
+ "inlinedDependencies": {
82
+ "type-fest": "5.8.0"
83
+ },
84
+ "gitHead": "b4c56347a01ac26a5e447c934a0c3c3308161bb5"
74
85
  }