azure-mock 2.37.2 → 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.
- package/LICENSE +201 -201
- package/dist/index.d.ts +168 -62
- package/dist/index.js +97 -67
- package/package.json +21 -10
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/
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
57
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,9 +931,10 @@ 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
|
-
* An in-memory mock of the Azure ContainerClient.
|
|
875
|
-
* It uses a Map to simulate blob storage.
|
|
937
|
+
* An in-memory mock of the Azure ContainerClient — no emulator and no network.
|
|
876
938
|
*
|
|
877
939
|
* @example
|
|
878
940
|
* const mockContainerClient = new MockContainerClient("", "hello world");
|
|
@@ -880,7 +942,7 @@ export declare class MockBlockBlobClient extends MockBlobClient implements Excep
|
|
|
880
942
|
* await blockBlobClient.upload("hello world", 11);
|
|
881
943
|
* const content = await blockBlobClient.downloadToBuffer();
|
|
882
944
|
*/
|
|
883
|
-
|
|
945
|
+
declare class MockContainerClient implements Except<ContainerClient, "accountName"> {
|
|
884
946
|
#private;
|
|
885
947
|
connectionString: string;
|
|
886
948
|
containerName: string;
|
|
@@ -917,21 +979,23 @@ export declare class MockContainerClient implements Except<ContainerClient, "acc
|
|
|
917
979
|
response: BlockBlobUploadResponse;
|
|
918
980
|
}>;
|
|
919
981
|
}
|
|
982
|
+
//#endregion
|
|
983
|
+
//#region src/models/eventGrid/MockEventGridPublisherClient.d.ts
|
|
920
984
|
/**
|
|
921
|
-
* An in-memory mock of the Azure EventGridPublisherClient.
|
|
922
|
-
* It uses a Map to simulate event grid storage and correctly implements the EventGridPublisherClient interface.
|
|
985
|
+
* An in-memory mock of the Azure EventGridPublisherClient — no emulator and no network.
|
|
923
986
|
* `client` is excluded because it is a private member of the real class and cannot be satisfied structurally.
|
|
924
987
|
*/
|
|
925
|
-
|
|
988
|
+
declare class MockEventGridPublisherClient implements Except<EventGridPublisherClient<"EventGrid">, "apiVersion"> {
|
|
926
989
|
readonly endpointUrl: string;
|
|
927
990
|
readonly inputSchema: "EventGrid";
|
|
928
991
|
readonly topicType: "EventGrid";
|
|
929
992
|
constructor(endpoint: string, topicType: "EventGrid");
|
|
930
993
|
send(newEvents: EventGridEvent<unknown>[]): Promise<void>;
|
|
931
994
|
}
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region src/models/queue/MockQueueClient.d.ts
|
|
932
997
|
/**
|
|
933
|
-
* An in-memory mock of the Azure QueueClient.
|
|
934
|
-
* It uses a Map to simulate queue storage and correctly implements the QueueClient interface.
|
|
998
|
+
* An in-memory mock of the Azure QueueClient — no emulator and no network.
|
|
935
999
|
*
|
|
936
1000
|
* @example
|
|
937
1001
|
* const mockQueueClient = new MockQueueClient("", "hello world");
|
|
@@ -939,7 +1003,7 @@ export declare class MockEventGridPublisherClient implements Except<EventGridPub
|
|
|
939
1003
|
* await mockQueueClient.sendMessage("hello world");
|
|
940
1004
|
* const messages = await mockQueueClient.peekMessages();
|
|
941
1005
|
*/
|
|
942
|
-
|
|
1006
|
+
declare class MockQueueClient implements Except<QueueClient, "accountName"> {
|
|
943
1007
|
connectionString: string;
|
|
944
1008
|
name: string;
|
|
945
1009
|
url: string;
|
|
@@ -967,16 +1031,18 @@ export declare class MockQueueClient implements Except<QueueClient, "accountName
|
|
|
967
1031
|
setMetadata(): Promise<QueueSetMetadataResponse>;
|
|
968
1032
|
updateMessage(): Promise<QueueUpdateMessageResponse>;
|
|
969
1033
|
}
|
|
1034
|
+
//#endregion
|
|
1035
|
+
//#region src/models/search/MockSearchClient.d.ts
|
|
970
1036
|
/**
|
|
971
|
-
* An in-memory mock of the Azure SearchClient.
|
|
972
|
-
*
|
|
1037
|
+
* An in-memory mock of the Azure SearchClient — no emulator and no network. It applies the same OData filtering
|
|
1038
|
+
* as the other mock clients, so a query behaves the same here as it does against the service.
|
|
973
1039
|
*
|
|
974
1040
|
* @example
|
|
975
1041
|
* const mockSearchClient = new MockSearchClient(SearchIndex.Messages);
|
|
976
1042
|
* await mockSearchClient.uploadDocuments([{ ... }]);
|
|
977
1043
|
* const { count, results } = await mockSearchClient.search("*", { filter, includeTotalCount: true });
|
|
978
1044
|
*/
|
|
979
|
-
|
|
1045
|
+
declare class MockSearchClient<TModel extends object = Record<string, unknown>> implements Except<SearchClient<TModel>, "pipeline"> {
|
|
980
1046
|
readonly apiVersion: string;
|
|
981
1047
|
readonly endpoint: string;
|
|
982
1048
|
readonly indexName: string;
|
|
@@ -995,15 +1061,16 @@ export declare class MockSearchClient<TModel extends object = Record<string, unk
|
|
|
995
1061
|
suggest<TFields extends SelectFields<TModel> = never>(_searchText: string, _suggesterName: string, _options?: SuggestOptions<TModel, TFields>): Promise<SuggestDocumentsResult<TModel, TFields>>;
|
|
996
1062
|
uploadDocuments(documents: TModel[], _options?: UploadDocumentsOptions): Promise<IndexDocumentsResult>;
|
|
997
1063
|
}
|
|
1064
|
+
//#endregion
|
|
1065
|
+
//#region src/models/serviceBus/MockServiceBusSender.d.ts
|
|
998
1066
|
/**
|
|
999
|
-
* An in-memory mock of the Azure ServiceBusSender.
|
|
1000
|
-
* It uses a Map to simulate a Service Bus queue and correctly implements the ServiceBusSender interface.
|
|
1067
|
+
* An in-memory mock of the Azure ServiceBusSender — no emulator and no network.
|
|
1001
1068
|
*
|
|
1002
1069
|
* @example
|
|
1003
1070
|
* const mockServiceBusSender = new MockServiceBusSender("hello world");
|
|
1004
1071
|
* await mockServiceBusSender.scheduleMessages({ body: "hello world" }, new Date());
|
|
1005
1072
|
*/
|
|
1006
|
-
|
|
1073
|
+
declare class MockServiceBusSender implements ServiceBusSender {
|
|
1007
1074
|
entityPath: string;
|
|
1008
1075
|
identifier: string;
|
|
1009
1076
|
isClosed: boolean;
|
|
@@ -1015,16 +1082,17 @@ export declare class MockServiceBusSender implements ServiceBusSender {
|
|
|
1015
1082
|
scheduleMessages(messages: ServiceBusMessage | ServiceBusMessage[], scheduledEnqueueTimeUtc: Date): Promise<never[]>;
|
|
1016
1083
|
sendMessages(messages: ServiceBusMessage | ServiceBusMessage[] | ServiceBusMessageBatch): Promise<void>;
|
|
1017
1084
|
}
|
|
1085
|
+
//#endregion
|
|
1086
|
+
//#region src/models/table/MockTableClient.d.ts
|
|
1018
1087
|
/**
|
|
1019
|
-
* An in-memory mock of the Azure TableClient.
|
|
1020
|
-
* It uses a Map to simulate table storage and correctly implements the TableClient interface.
|
|
1088
|
+
* An in-memory mock of the Azure TableClient — no emulator and no network.
|
|
1021
1089
|
*
|
|
1022
1090
|
* @example
|
|
1023
1091
|
* const mockTableClient = new MockTableClient("", "hello world");
|
|
1024
1092
|
* await mockTableClient.createEntity({ partitionKey: "partitionKey", rowKey: "rowKey" });
|
|
1025
1093
|
* const entity = await mockTableClient.getEntity("partitionKey", "rowKey");
|
|
1026
1094
|
*/
|
|
1027
|
-
|
|
1095
|
+
declare class MockTableClient<TEntity extends TableEntity = TableEntity> implements Except<TableClient, "pipeline"> {
|
|
1028
1096
|
#private;
|
|
1029
1097
|
entityType: TEntity;
|
|
1030
1098
|
tableName: string;
|
|
@@ -1045,49 +1113,87 @@ export declare class MockTableClient<TEntity extends TableEntity = TableEntity>
|
|
|
1045
1113
|
}): Promise<TableMergeEntityHeaders>;
|
|
1046
1114
|
upsertEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode): Promise<TableMergeEntityHeaders>;
|
|
1047
1115
|
}
|
|
1116
|
+
//#endregion
|
|
1117
|
+
//#region src/models/webPubSub/MockWebPubSubServiceClient.d.ts
|
|
1048
1118
|
/**
|
|
1049
1119
|
* A minimal mock of the Azure WebPubSubServiceClient for testing purposes.
|
|
1050
1120
|
* Only implements `group().sendToAll` — the only method used in azure-functions tests.
|
|
1051
1121
|
*/
|
|
1052
|
-
|
|
1122
|
+
declare class MockWebPubSubServiceClient {
|
|
1053
1123
|
group(_groupName: string): {
|
|
1054
1124
|
sendToAll: () => Promise<void>;
|
|
1055
1125
|
};
|
|
1056
1126
|
}
|
|
1057
|
-
|
|
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
|
|
1058
1132
|
/**
|
|
1059
1133
|
* Generates a standard Azure Storage error XML response body.
|
|
1060
1134
|
* @param errorCode The official Azure error code (e.g., "BlobNotFound").
|
|
1061
1135
|
* @param errorMessage The user-friendly error message.
|
|
1062
1136
|
* @returns A formatted XML string.
|
|
1063
1137
|
*/
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
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 | {
|
|
1069
1151
|
blobName: string;
|
|
1070
1152
|
containerName: string;
|
|
1071
1153
|
};
|
|
1072
|
-
|
|
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
|
|
1073
1159
|
/**
|
|
1074
1160
|
* Generates a standard Azure Storage list blobs XML response body.
|
|
1075
1161
|
* @param containerName The container name.
|
|
1076
1162
|
* @param blobsXml The blobs xml data.
|
|
1077
1163
|
* @returns A formatted XML string.
|
|
1078
1164
|
*/
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
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) => {
|
|
1088
1190
|
expiresOn: Date;
|
|
1089
1191
|
insertedOn: Date;
|
|
1090
1192
|
messageId: string;
|
|
1091
1193
|
messageText: string;
|
|
1092
1194
|
};
|
|
1093
|
-
|
|
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 };
|