azure-mock 4.2.0 → 4.3.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.
@@ -0,0 +1,1240 @@
1
+ import { HttpHeadersLike, WebResourceLike } from "@azure/core-http-compat";
2
+ import { PipelineRequest, RestError } from "@azure/core-rest-pipeline";
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, Metadata, PageBlobClient, PollOperationState, PollerLikeWithCancellation, StorageSharedKeyCredential } from "@azure/storage-blob";
4
+ import { BinaryOperator, Clause } from "@esposter/azure";
5
+ import { EventGridEvent, EventGridPublisherClient } from "@azure/eventgrid";
6
+ 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";
7
+ import { AutocompleteResult, CountDocumentsOptions, DeleteDocumentsOptions, GetDocumentOptions, IndexDocumentsBatch, IndexDocumentsOptions, IndexDocumentsResult, MergeDocumentsOptions, MergeOrUploadDocumentsOptions, NarrowedModel, SearchClient, SearchDocumentsResult, SearchOptions, SelectFields, SuggestDocumentsResult, SuggestOptions, UploadDocumentsOptions } from "@azure/search-documents";
8
+ import { ServiceBusMessage, ServiceBusMessageBatch, ServiceBusSender } from "@azure/service-bus";
9
+ import { CreateTableEntityResponse, GetAccessPolicyResponse, GetTableEntityResponse, ListTableEntitiesOptions, TableClient, TableDeleteEntityHeaders, TableEntity, TableEntityResult, TableEntityResultPage, TableMergeEntityHeaders, TableSetAccessPolicyHeaders, TableTransactionResponse, UpdateMode } from "@azure/data-tables";
10
+ //#region src/constants.d.ts
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 CONDITION_NOT_MET_ERROR_CODE = "ConditionNotMet";
14
+ export declare const CONDITION_NOT_MET_MESSAGE = "The condition specified using HTTP conditional header(s) is not met.";
15
+ export declare const MOCK_BLOB_BASE_URL = "https://mockaccount.blob.core.windows.net";
16
+ export declare const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
17
+ export declare const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
18
+ export declare const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
19
+ //#endregion
20
+ //#region src/models/container/BlobHierarchyItem.d.ts
21
+ export type BlobHierarchyItem = (BlobItem & {
22
+ kind: "blob";
23
+ }) | (BlobPrefix & {
24
+ kind: "prefix";
25
+ });
26
+ //#endregion
27
+ //#region src/store/MockContainerDatabase.d.ts
28
+ export declare const MockContainerDatabase: Map<string, Map<string, Buffer>>;
29
+ //#endregion
30
+ //#region src/util/types/MapValue.d.ts
31
+ export type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
32
+ //#endregion
33
+ //#region src/models/container/MockBlobBatchClient.d.ts
34
+ export declare class MockBlobBatchClient implements BlobBatchClient {
35
+ #private;
36
+ url: string;
37
+ constructor(url: string);
38
+ /**
39
+ * Simulates the deletion of multiple blobs in a single batch request.
40
+ * It iterates through the requested deletions, removes existing blobs from the
41
+ * underlying MockContainerDatabase, and builds a response object that reports
42
+ * which deletions succeeded and which failed (e.g. for blobs that didn't exist).
43
+ */
44
+ deleteBlobs(urls: string[], credential: AnonymousCredential | StorageSharedKeyCredential, options?: BlobDeleteOptions): Promise<BlobBatchDeleteBlobsResponse>;
45
+ getContainer(containerName: string): MapValue<typeof MockContainerDatabase>;
46
+ }
47
+ //#endregion
48
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-any.d.ts
49
+ /**
50
+ Returns a boolean for whether the given type is `any`.
51
+
52
+ @link https://stackoverflow.com/a/49928360/1490091
53
+
54
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
55
+
56
+ @example
57
+ ```
58
+ import type {IsAny} from 'type-fest';
59
+
60
+ const typedObject = {a: 1, b: 2} as const;
61
+ const anyObject: any = {a: 1, b: 2};
62
+
63
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
64
+ return object[key];
65
+ }
66
+
67
+ const typedA = get(typedObject, 'a');
68
+ //=> 1
69
+
70
+ const anyA = get(anyObject, 'a');
71
+ //=> any
72
+ ```
73
+
74
+ @category Type Guard
75
+ @category Utilities
76
+ */
77
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
78
+ //#endregion
79
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-optional-key-of.d.ts
80
+ /**
81
+ Returns a boolean for whether the given key is an optional key of type.
82
+
83
+ This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
84
+
85
+ @example
86
+ ```
87
+ import type {IsOptionalKeyOf} from 'type-fest';
88
+
89
+ type User = {
90
+ name: string;
91
+ surname: string;
92
+
93
+ luckyNumber?: number;
94
+ };
95
+
96
+ type Admin = {
97
+ name: string;
98
+ surname?: string;
99
+ };
100
+
101
+ type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
102
+ //=> true
103
+
104
+ type T2 = IsOptionalKeyOf<User, 'name'>;
105
+ //=> false
106
+
107
+ type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
108
+ //=> boolean
109
+
110
+ type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
111
+ //=> false
112
+
113
+ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
114
+ //=> boolean
115
+ ```
116
+
117
+ @category Type Guard
118
+ @category Utilities
119
+ */
120
+ 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;
121
+ //#endregion
122
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/optional-keys-of.d.ts
123
+ /**
124
+ Extract all optional keys from the given type.
125
+
126
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
127
+
128
+ @example
129
+ ```
130
+ import type {OptionalKeysOf, Except} from 'type-fest';
131
+
132
+ type User = {
133
+ name: string;
134
+ surname: string;
135
+
136
+ luckyNumber?: number;
137
+ };
138
+
139
+ const REMOVE_FIELD = Symbol('remove field symbol');
140
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
141
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
142
+ };
143
+
144
+ const update1: UpdateOperation<User> = {
145
+ name: 'Alice',
146
+ };
147
+
148
+ const update2: UpdateOperation<User> = {
149
+ name: 'Bob',
150
+ luckyNumber: REMOVE_FIELD,
151
+ };
152
+ ```
153
+
154
+ @category Utilities
155
+ */
156
+ type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
157
+ ? (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`
158
+ : never; // Should never happen
159
+ //#endregion
160
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/required-keys-of.d.ts
161
+ /**
162
+ Extract all required keys from the given type.
163
+
164
+ This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
165
+
166
+ @example
167
+ ```
168
+ import type {RequiredKeysOf} from 'type-fest';
169
+
170
+ declare function createValidation<
171
+ Entity extends object,
172
+ Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
173
+ >(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
174
+
175
+ type User = {
176
+ name: string;
177
+ surname: string;
178
+ luckyNumber?: number;
179
+ };
180
+
181
+ const validator1 = createValidation<User>('name', value => value.length < 25);
182
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
183
+
184
+ // @ts-expect-error
185
+ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
186
+ // Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
187
+ ```
188
+
189
+ @category Utilities
190
+ */
191
+ type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
192
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
193
+ //#endregion
194
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-never.d.ts
195
+ /**
196
+ Returns a boolean for whether the given type is `never`.
197
+
198
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
199
+ @link https://stackoverflow.com/a/53984913/10292952
200
+ @link https://www.zhenghao.io/posts/ts-never
201
+
202
+ Useful in type utilities, such as checking if something does not occur.
203
+
204
+ @example
205
+ ```
206
+ import type {IsNever, And} from 'type-fest';
207
+
208
+ type A = IsNever<never>;
209
+ //=> true
210
+
211
+ type B = IsNever<any>;
212
+ //=> false
213
+
214
+ type C = IsNever<unknown>;
215
+ //=> false
216
+
217
+ type D = IsNever<never[]>;
218
+ //=> false
219
+
220
+ type E = IsNever<object>;
221
+ //=> false
222
+
223
+ type F = IsNever<string>;
224
+ //=> false
225
+ ```
226
+
227
+ @example
228
+ ```
229
+ import type {IsNever} from 'type-fest';
230
+
231
+ type IsTrue<T> = T extends true ? true : false;
232
+
233
+ // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
234
+ type A = IsTrue<never>;
235
+ //=> never
236
+
237
+ // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
238
+ type IsTrueFixed<T> =
239
+ IsNever<T> extends true ? false : T extends true ? true : false;
240
+
241
+ type B = IsTrueFixed<never>;
242
+ //=> false
243
+ ```
244
+
245
+ @category Type Guard
246
+ @category Utilities
247
+ */
248
+ type IsNever<T> = [T] extends [never] ? true : false;
249
+ //#endregion
250
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/if.d.ts
251
+ /**
252
+ An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
253
+
254
+ Use-cases:
255
+ - You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
256
+
257
+ Note:
258
+ - Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
259
+ - Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
260
+
261
+ @example
262
+ ```
263
+ import type {If} from 'type-fest';
264
+
265
+ type A = If<true, 'yes', 'no'>;
266
+ //=> 'yes'
267
+
268
+ type B = If<false, 'yes', 'no'>;
269
+ //=> 'no'
270
+
271
+ type C = If<boolean, 'yes', 'no'>;
272
+ //=> 'yes' | 'no'
273
+
274
+ type D = If<any, 'yes', 'no'>;
275
+ //=> 'yes' | 'no'
276
+
277
+ type E = If<never, 'yes', 'no'>;
278
+ //=> 'no'
279
+ ```
280
+
281
+ @example
282
+ ```
283
+ import type {If, IsAny, IsNever} from 'type-fest';
284
+
285
+ type A = If<IsAny<unknown>, 'is any', 'not any'>;
286
+ //=> 'not any'
287
+
288
+ type B = If<IsNever<never>, 'is never', 'not never'>;
289
+ //=> 'is never'
290
+ ```
291
+
292
+ @example
293
+ ```
294
+ import type {If, IsEqual} from 'type-fest';
295
+
296
+ type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
297
+
298
+ type A = IfEqual<string, string, 'equal', 'not equal'>;
299
+ //=> 'equal'
300
+
301
+ type B = IfEqual<string, number, 'equal', 'not equal'>;
302
+ //=> 'not equal'
303
+ ```
304
+
305
+ Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
306
+
307
+ @example
308
+ ```
309
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
310
+
311
+ type HundredZeroes = StringRepeat<'0', 100>;
312
+
313
+ // The following implementation is not tail recursive
314
+ type Includes<S extends string, Char extends string> =
315
+ S extends `${infer First}${infer Rest}`
316
+ ? If<IsEqual<First, Char>,
317
+ 'found',
318
+ Includes<Rest, Char>>
319
+ : 'not found';
320
+
321
+ // Hence, instantiations with long strings will fail
322
+ // @ts-expect-error
323
+ type Fails = Includes<HundredZeroes, '1'>;
324
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325
+ // Error: Type instantiation is excessively deep and possibly infinite.
326
+
327
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
328
+ type IncludesWithoutIf<S extends string, Char extends string> =
329
+ S extends `${infer First}${infer Rest}`
330
+ ? IsEqual<First, Char> extends true
331
+ ? 'found'
332
+ : IncludesWithoutIf<Rest, Char>
333
+ : 'not found';
334
+
335
+ // Now, instantiations with long strings will work
336
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
337
+ //=> 'not found'
338
+ ```
339
+
340
+ @category Type Guard
341
+ @category Utilities
342
+ */
343
+ type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
344
+ //#endregion
345
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/simplify.d.ts
346
+ /**
347
+ 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.
348
+
349
+ @example
350
+ ```
351
+ import type {Simplify} from 'type-fest';
352
+
353
+ type PositionProps = {
354
+ top: number;
355
+ left: number;
356
+ };
357
+
358
+ type SizeProps = {
359
+ width: number;
360
+ height: number;
361
+ };
362
+
363
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
364
+ type Props = Simplify<PositionProps & SizeProps>;
365
+ ```
366
+
367
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
368
+
369
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
370
+
371
+ @example
372
+ ```
373
+ import type {Simplify} from 'type-fest';
374
+
375
+ interface SomeInterface {
376
+ foo: number;
377
+ bar?: string;
378
+ baz: number | undefined;
379
+ }
380
+
381
+ type SomeType = {
382
+ foo: number;
383
+ bar?: string;
384
+ baz: number | undefined;
385
+ };
386
+
387
+ const literal = {foo: 123, bar: 'hello', baz: 456};
388
+ const someType: SomeType = literal;
389
+ const someInterface: SomeInterface = literal;
390
+
391
+ declare function fn(object: Record<string, unknown>): void;
392
+
393
+ fn(literal); // Good: literal object type is sealed
394
+ fn(someType); // Good: type is sealed
395
+ // @ts-expect-error
396
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
397
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
398
+ ```
399
+
400
+ @link https://github.com/microsoft/TypeScript/issues/15300
401
+ @see {@link SimplifyDeep}
402
+ @category Object
403
+ */
404
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
405
+ //#endregion
406
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-equal.d.ts
407
+ /**
408
+ Returns a boolean for whether the two given types are equal.
409
+
410
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
411
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
412
+
413
+ Use-cases:
414
+ - If you want to make a conditional branch based on the result of a comparison of two types.
415
+
416
+ @example
417
+ ```
418
+ import type {IsEqual} from 'type-fest';
419
+
420
+ // This type returns a boolean for whether the given array includes the given item.
421
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
422
+ type Includes<Value extends readonly any[], Item> =
423
+ Value extends readonly [Value[0], ...infer rest]
424
+ ? IsEqual<Value[0], Item> extends true
425
+ ? true
426
+ : Includes<rest, Item>
427
+ : false;
428
+ ```
429
+
430
+ @category Type Guard
431
+ @category Utilities
432
+ */
433
+ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
434
+ // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
435
+ type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
436
+ //#endregion
437
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/omit-index-signature.d.ts
438
+ /**
439
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
440
+
441
+ This is the counterpart of `PickIndexSignature`.
442
+
443
+ Use-cases:
444
+ - Remove overly permissive signatures from third-party types.
445
+
446
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
447
+
448
+ It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
449
+
450
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
451
+
452
+ ```
453
+ const indexed: Record<string, unknown> = {}; // Allowed
454
+
455
+ // @ts-expect-error
456
+ const keyed: Record<'foo', unknown> = {}; // Error
457
+ // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
458
+ ```
459
+
460
+ Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
461
+
462
+ ```
463
+ type Indexed = {} extends Record<string, unknown>
464
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
465
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
466
+
467
+ type IndexedResult = Indexed;
468
+ //=> '✅ `{}` is assignable to `Record<string, unknown>`'
469
+
470
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
471
+ ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
472
+ : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
473
+
474
+ type KeyedResult = Keyed;
475
+ //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
476
+ ```
477
+
478
+ Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
479
+
480
+ ```
481
+ type OmitIndexSignature<ObjectType> = {
482
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
483
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
484
+ };
485
+ ```
486
+
487
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
488
+
489
+ ```
490
+ type OmitIndexSignature<ObjectType> = {
491
+ [KeyType in keyof ObjectType
492
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
493
+ as {} extends Record<KeyType, unknown>
494
+ ? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
495
+ : KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
496
+ ]: ObjectType[KeyType];
497
+ };
498
+ ```
499
+
500
+ If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
501
+
502
+ @example
503
+ ```
504
+ import type {OmitIndexSignature} from 'type-fest';
505
+
506
+ type Example = {
507
+ // These index signatures will be removed.
508
+ [x: string]: any;
509
+ [x: number]: any;
510
+ [x: symbol]: any;
511
+ [x: `head-${string}`]: string;
512
+ [x: `${string}-tail`]: string;
513
+ [x: `head-${string}-tail`]: string;
514
+ [x: `${bigint}`]: string;
515
+ [x: `embedded-${number}`]: string;
516
+
517
+ // These explicitly defined keys will remain.
518
+ foo: 'bar';
519
+ qux?: 'baz';
520
+ };
521
+
522
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
523
+ //=> {foo: 'bar'; qux?: 'baz'}
524
+ ```
525
+
526
+ @see {@link PickIndexSignature}
527
+ @category Object
528
+ */
529
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
530
+ //#endregion
531
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/pick-index-signature.d.ts
532
+ /**
533
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
534
+
535
+ This is the counterpart of `OmitIndexSignature`.
536
+
537
+ @example
538
+ ```
539
+ import type {PickIndexSignature} from 'type-fest';
540
+
541
+ declare const symbolKey: unique symbol;
542
+
543
+ type Example = {
544
+ // These index signatures will remain.
545
+ [x: string]: unknown;
546
+ [x: number]: unknown;
547
+ [x: symbol]: unknown;
548
+ [x: `head-${string}`]: string;
549
+ [x: `${string}-tail`]: string;
550
+ [x: `head-${string}-tail`]: string;
551
+ [x: `${bigint}`]: string;
552
+ [x: `embedded-${number}`]: string;
553
+
554
+ // These explicitly defined keys will be removed.
555
+ ['kebab-case-key']: string;
556
+ [symbolKey]: string;
557
+ foo: 'bar';
558
+ qux?: 'baz';
559
+ };
560
+
561
+ type ExampleIndexSignature = PickIndexSignature<Example>;
562
+ // {
563
+ // [x: string]: unknown;
564
+ // [x: number]: unknown;
565
+ // [x: symbol]: unknown;
566
+ // [x: `head-${string}`]: string;
567
+ // [x: `${string}-tail`]: string;
568
+ // [x: `head-${string}-tail`]: string;
569
+ // [x: `${bigint}`]: string;
570
+ // [x: `embedded-${number}`]: string;
571
+ // }
572
+ ```
573
+
574
+ @see {@link OmitIndexSignature}
575
+ @category Object
576
+ */
577
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
578
+ //#endregion
579
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/merge.d.ts
580
+ // Merges two objects without worrying about index signatures.
581
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
582
+ /**
583
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
584
+
585
+ This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.
586
+
587
+ @example
588
+ ```
589
+ import type {Merge} from 'type-fest';
590
+
591
+ type Foo = {
592
+ a: string;
593
+ b: number;
594
+ };
595
+
596
+ type Bar = {
597
+ a: number; // Conflicts with Foo['a']
598
+ c: boolean;
599
+ };
600
+
601
+ // With `&`, `a` becomes `string & number` which is `never`. Not what you want.
602
+ type WithIntersection = (Foo & Bar)['a'];
603
+ //=> never
604
+
605
+ // With `Merge`, `a` is cleanly overridden to `number`.
606
+ type WithMerge = Merge<Foo, Bar>['a'];
607
+ //=> number
608
+ ```
609
+
610
+ @example
611
+ ```
612
+ import type {Merge} from 'type-fest';
613
+
614
+ type Foo = {
615
+ [x: string]: unknown;
616
+ [x: number]: unknown;
617
+ foo: string;
618
+ bar: symbol;
619
+ };
620
+
621
+ type Bar = {
622
+ [x: number]: number;
623
+ [x: symbol]: unknown;
624
+ bar: Date;
625
+ baz: boolean;
626
+ };
627
+
628
+ export type FooBar = Merge<Foo, Bar>;
629
+ //=> {
630
+ // [x: string]: unknown;
631
+ // [x: number]: number;
632
+ // [x: symbol]: unknown;
633
+ // foo: string;
634
+ // bar: Date;
635
+ // baz: boolean;
636
+ // }
637
+ ```
638
+
639
+ Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
640
+
641
+ @see {@link ObjectMerge}
642
+ @category Object
643
+ */
644
+ type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
645
+ ? Source extends unknown // For distributing `Source`
646
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
647
+ : never; // Should never happen
648
+ type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
649
+ //#endregion
650
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/object.d.ts
651
+ /**
652
+ Merges user specified options with default options.
653
+
654
+ @example
655
+ ```
656
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
657
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
658
+ type SpecifiedOptions = {leavesOnly: true};
659
+
660
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
661
+ //=> {maxRecursionDepth: 10; leavesOnly: true}
662
+ ```
663
+
664
+ @example
665
+ ```
666
+ // Complains if default values are not provided for optional options
667
+
668
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
669
+ type DefaultPathsOptions = {maxRecursionDepth: 10};
670
+ type SpecifiedOptions = {};
671
+
672
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
673
+ // ~~~~~~~~~~~~~~~~~~~
674
+ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
675
+ ```
676
+
677
+ @example
678
+ ```
679
+ // Complains if an option's default type does not conform to the expected type
680
+
681
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
682
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
683
+ type SpecifiedOptions = {};
684
+
685
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
686
+ // ~~~~~~~~~~~~~~~~~~~
687
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
688
+ ```
689
+
690
+ @example
691
+ ```
692
+ // Complains if an option's specified type does not conform to the expected type
693
+
694
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
695
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
696
+ type SpecifiedOptions = {leavesOnly: 'yes'};
697
+
698
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
699
+ // ~~~~~~~~~~~~~~~~
700
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
701
+ ```
702
+ */
703
+ 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>`
704
+ ) ? Result : never;
705
+ 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]; }>>>;
706
+ //#endregion
707
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/except.d.ts
708
+ /**
709
+ Filter out keys from an object.
710
+
711
+ Returns `never` if `Exclude` is strictly equal to `Key`.
712
+ Returns `never` if `Key` extends `Exclude`.
713
+ Returns `Key` otherwise.
714
+
715
+ @example
716
+ ```
717
+ type Filtered = Filter<'foo', 'foo'>;
718
+ //=> never
719
+ ```
720
+
721
+ @example
722
+ ```
723
+ type Filtered = Filter<'bar', string>;
724
+ //=> never
725
+ ```
726
+
727
+ @example
728
+ ```
729
+ type Filtered = Filter<'bar', 'foo'>;
730
+ //=> 'bar'
731
+ ```
732
+
733
+ @see {Except}
734
+ */
735
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
736
+ type ExceptOptions = {
737
+ /**
738
+ Disallow assigning non-specified properties.
739
+
740
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
741
+
742
+ @default false
743
+ */
744
+ requireExactProps?: boolean;
745
+ };
746
+ type DefaultExceptOptions = {
747
+ requireExactProps: false;
748
+ };
749
+ /**
750
+ Create a type from an object type without certain keys.
751
+
752
+ We recommend setting the `requireExactProps` option to `true`.
753
+
754
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
755
+
756
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
757
+
758
+ @example
759
+ ```
760
+ import type {Except} from 'type-fest';
761
+
762
+ type Foo = {
763
+ a: number;
764
+ b: string;
765
+ };
766
+
767
+ type FooWithoutA = Except<Foo, 'a'>;
768
+ //=> {b: string}
769
+
770
+ // @ts-expect-error
771
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
772
+ // errors: 'a' does not exist in type '{ b: string; }'
773
+
774
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
775
+ //=> {a: number} & Partial<Record<'b', never>>
776
+
777
+ // @ts-expect-error
778
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
779
+ // errors at 'b': Type 'string' is not assignable to type 'undefined'.
780
+
781
+ // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
782
+
783
+ // Consider the following example:
784
+
785
+ type UserData = {
786
+ [metadata: string]: string;
787
+ email: string;
788
+ name: string;
789
+ role: 'admin' | 'user';
790
+ };
791
+
792
+ // `Omit` clearly doesn't behave as expected in this case:
793
+ type PostPayload = Omit<UserData, 'email'>;
794
+ //=> {[x: string]: string; [x: number]: string}
795
+
796
+ // In situations like this, `Except` works better.
797
+ // It simply removes the `email` key while preserving all the other keys.
798
+ type PostPayloadFixed = Except<UserData, 'email'>;
799
+ //=> {[x: string]: string; name: string; role: 'admin' | 'user'}
800
+ ```
801
+
802
+ @category Object
803
+ */
804
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
805
+ 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>> : {});
806
+ //#endregion
807
+ //#region src/models/container/MockBlobClient.d.ts
808
+ export declare class MockBlobClient implements Except<BlobClient, "accountName"> {
809
+ connectionString: string;
810
+ containerName: string;
811
+ credential: AnonymousCredential;
812
+ name: string;
813
+ url: string;
814
+ get container(): MapValue<typeof MockContainerDatabase>;
815
+ constructor(connectionString: string, containerName: string, blobName: string);
816
+ abortCopyFromURL(): Promise<BlobAbortCopyFromURLResponse>;
817
+ beginCopyFromURL(copySource: string): Promise<PollerLikeWithCancellation<PollOperationState<BlobBeginCopyFromURLResponse>, BlobBeginCopyFromURLResponse>>;
818
+ createSnapshot(): Promise<BlobCreateSnapshotResponse>;
819
+ delete(): Promise<BlobDeleteResponse>;
820
+ deleteIfExists(): Promise<BlobDeleteIfExistsResponse>;
821
+ deleteImmutabilityPolicy(): Promise<BlobDeleteImmutabilityPolicyResponse>;
822
+ download(): Promise<BlobDownloadResponseParsed>;
823
+ downloadToBuffer(): Promise<Buffer>;
824
+ downloadToFile(): Promise<BlobDownloadResponseParsed>;
825
+ exists(): Promise<boolean>;
826
+ generateSasStringToSign(): string;
827
+ generateSasUrl(options: BlobGenerateSasUrlOptions): Promise<string>;
828
+ generateUserDelegationSasStringToSign(): string;
829
+ generateUserDelegationSasUrl(): Promise<string>;
830
+ getAccountInfo(): Promise<BlobGetAccountInfoResponse>;
831
+ getAppendBlobClient(): AppendBlobClient;
832
+ getBlobLeaseClient(): BlobLeaseClient;
833
+ getBlockBlobClient(): BlockBlobClient;
834
+ getPageBlobClient(): PageBlobClient;
835
+ getProperties(): Promise<BlobGetPropertiesResponse>;
836
+ getTags(): Promise<BlobGetTagsResponse>;
837
+ setAccessTier(): Promise<BlobSetTierResponse>;
838
+ setHTTPHeaders(): Promise<BlobSetHTTPHeadersResponse>;
839
+ setImmutabilityPolicy(): Promise<BlobSetImmutabilityPolicyResponse>;
840
+ setLegalHold(): Promise<BlobSetLegalHoldResponse>;
841
+ setMetadata(metadata?: Metadata): Promise<BlobSetMetadataResponse>;
842
+ setTags(): Promise<BlobSetTagsResponse>;
843
+ syncCopyFromURL(): Promise<BlobCopyFromURLResponse>;
844
+ undelete(): Promise<BlobUndeleteResponse>;
845
+ withSnapshot(): BlockBlobClient;
846
+ withVersion(): BlobClient;
847
+ }
848
+ //#endregion
849
+ //#region src/models/container/MockBlobDates.d.ts
850
+ export interface MockBlobDates {
851
+ createdOn: Date;
852
+ etag: string;
853
+ lastModified: Date;
854
+ }
855
+ //#endregion
856
+ //#region src/models/container/MockBlockBlobClient.d.ts
857
+ export declare class MockBlockBlobClient extends MockBlobClient implements Except<BlockBlobClient, "accountName"> {
858
+ commitBlockList(): Promise<BlockBlobCommitBlockListResponse>;
859
+ getBlockList(): Promise<BlockBlobGetBlockListResponse>;
860
+ query(): Promise<BlobDownloadResponseModel>;
861
+ stageBlock(): Promise<BlockBlobStageBlockResponse>;
862
+ stageBlockFromURL(): Promise<BlockBlobStageBlockFromURLResponse>;
863
+ syncUploadFromURL(): Promise<BlockBlobPutBlobFromUrlResponse>;
864
+ upload(body: HttpRequestBody, _contentLength: number, options?: BlockBlobUploadOptions): Promise<BlockBlobUploadResponse>;
865
+ uploadBrowserData(): Promise<BlobUploadCommonResponse>;
866
+ uploadData(): Promise<BlobUploadCommonResponse>;
867
+ uploadFile(): Promise<BlobUploadCommonResponse>;
868
+ uploadStream(): Promise<BlobUploadCommonResponse>;
869
+ }
870
+ //#endregion
871
+ //#region src/models/shared/PageSettings.d.ts
872
+ /**
873
+ * An interface that tracks the settings for paged iteration
874
+ */
875
+ export interface PageSettings {
876
+ /**
877
+ * The token that keeps track of where to continue the iterator
878
+ */
879
+ continuationToken?: string;
880
+ /**
881
+ * The size of the page during paged iteration
882
+ */
883
+ maxPageSize?: number;
884
+ }
885
+ //#endregion
886
+ //#region src/models/shared/PagedAsyncIterableIterator.d.ts
887
+ /**
888
+ * An interface that allows async iterable iteration both to completion and by page.
889
+ */
890
+ export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
891
+ /**
892
+ * The connection to the async iterator, part of the iteration protocol
893
+ */
894
+ [Symbol.asyncIterator]: () => PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
895
+ /**
896
+ * Return an AsyncIterableIterator that works a page at a time
897
+ */
898
+ byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;
899
+ /**
900
+ * The next method, part of the iteration protocol
901
+ */
902
+ next: () => Promise<IteratorResult<TElement>>;
903
+ }
904
+ //#endregion
905
+ //#region src/models/container/MockContainerClient.d.ts
906
+ /**
907
+ * An in-memory mock of the Azure ContainerClient — no emulator and no network.
908
+ *
909
+ * @example
910
+ * const mockContainerClient = new MockContainerClient("", "hello world");
911
+ * const blockBlobClient = mockContainerClient.getBlockBlobClient("hello world.txt");
912
+ * await blockBlobClient.upload("hello world", 11);
913
+ * const content = await blockBlobClient.downloadToBuffer();
914
+ */
915
+ export declare class MockContainerClient implements Except<ContainerClient, "accountName"> {
916
+ #private;
917
+ connectionString: string;
918
+ containerName: string;
919
+ credential: AnonymousCredential;
920
+ url: string;
921
+ get container(): MapValue<typeof MockContainerDatabase>;
922
+ constructor(connectionString: string, containerName: string);
923
+ create(): Promise<ContainerCreateResponse>;
924
+ createIfNotExists(): Promise<ContainerCreateIfNotExistsResponse>;
925
+ delete(): Promise<ContainerDeleteResponse>;
926
+ deleteBlob(blobName: string): Promise<BlobDeleteResponse>;
927
+ deleteIfExists(): Promise<ContainerDeleteIfExistsResponse>;
928
+ exists(): Promise<boolean>;
929
+ findBlobsByTags(): PagedAsyncIterableIterator<FilterBlobItem, ContainerFindBlobsByTagsSegmentResponse>;
930
+ generateSasStringToSign(): string;
931
+ generateSasUrl(options: ContainerGenerateSasUrlOptions): Promise<string>;
932
+ generateUserDelegationSasStringToSign(): string;
933
+ generateUserDelegationSasUrl(): Promise<string>;
934
+ getAccessPolicy(): Promise<ContainerGetAccessPolicyResponse>;
935
+ getAccountInfo(): Promise<ContainerGetAccountInfoResponse>;
936
+ getAppendBlobClient(): AppendBlobClient;
937
+ getBlobBatchClient(): BlobBatchClient;
938
+ getBlobClient(blobName: string): BlobClient;
939
+ getBlobLeaseClient(): BlobLeaseClient;
940
+ getBlockBlobClient(blobName: string): BlockBlobClient;
941
+ getPageBlobClient(): PageBlobClient;
942
+ getProperties(): Promise<ContainerGetPropertiesResponse>;
943
+ listBlobsByHierarchy(delimiter: string, options?: ContainerListBlobsOptions): PagedAsyncIterableIterator<BlobHierarchyItem, ContainerListBlobHierarchySegmentResponse>;
944
+ listBlobsFlat(options?: ContainerListBlobsOptions): PagedAsyncIterableIterator<BlobItem, ContainerListBlobFlatSegmentResponse>;
945
+ setAccessPolicy(): Promise<ContainerSetAccessPolicyResponse>;
946
+ setMetadata(): Promise<ContainerSetMetadataResponse>;
947
+ uploadBlockBlob(blobName: string, body: HttpRequestBody, contentLength: number): Promise<{
948
+ blockBlobClient: BlockBlobClient;
949
+ response: BlockBlobUploadResponse;
950
+ }>;
951
+ }
952
+ //#endregion
953
+ //#region src/models/eventGrid/MockEventGridPublisherClient.d.ts
954
+ /**
955
+ * An in-memory mock of the Azure EventGridPublisherClient — no emulator and no network.
956
+ * `client` is excluded because it is a private member of the real class and cannot be satisfied structurally.
957
+ */
958
+ export declare class MockEventGridPublisherClient implements Except<EventGridPublisherClient<"EventGrid">, "apiVersion"> {
959
+ readonly endpointUrl: string;
960
+ readonly inputSchema: "EventGrid";
961
+ readonly topicType: "EventGrid";
962
+ constructor(endpoint: string, topicType: "EventGrid");
963
+ send(newEvents: EventGridEvent<unknown>[]): Promise<void>;
964
+ }
965
+ //#endregion
966
+ //#region src/store/MockQueueDatabase.d.ts
967
+ export declare const MockQueueDatabase: Map<string, string[]>;
968
+ //#endregion
969
+ //#region src/models/queue/MockQueueClient.d.ts
970
+ /**
971
+ * An in-memory mock of the Azure QueueClient — no emulator and no network.
972
+ *
973
+ * @example
974
+ * const mockQueueClient = new MockQueueClient("", "hello world");
975
+ * await mockQueueClient.createIfNotExists();
976
+ * await mockQueueClient.sendMessage("hello world");
977
+ * const messages = await mockQueueClient.peekMessages();
978
+ */
979
+ export declare class MockQueueClient implements Except<QueueClient, "accountName"> {
980
+ connectionString: string;
981
+ name: string;
982
+ url: string;
983
+ get queue(): MapValue<typeof MockQueueDatabase>;
984
+ constructor(connectionString: string, queueName: string);
985
+ clearMessages(): Promise<QueueClearMessagesResponse>;
986
+ create(_options?: QueueCreateOptions): Promise<QueueCreateResponse>;
987
+ createIfNotExists(): Promise<QueueCreateIfNotExistsResponse>;
988
+ delete(): Promise<QueueDeleteResponse>;
989
+ deleteIfExists(): Promise<QueueDeleteIfExistsResponse>;
990
+ deleteMessage(): Promise<QueueDeleteMessageResponse>;
991
+ exists(): Promise<boolean>;
992
+ generateSasStringToSign(): string;
993
+ generateSasUrl(options: QueueGenerateSasUrlOptions): string;
994
+ generateUserDelegationSasUrl(): string;
995
+ generateUserDelegationStringToSign(): string;
996
+ getAccessPolicy(): Promise<QueueGetAccessPolicyResponse>;
997
+ getProperties(): Promise<QueueGetPropertiesResponse>;
998
+ getServiceProperties(): Promise<QueueServiceProperties>;
999
+ listQueues(): AsyncIterableIterator<QueueItem>;
1000
+ peekMessages(_options?: QueuePeekMessagesOptions): Promise<QueuePeekMessagesResponse>;
1001
+ receiveMessages(_options?: QueueReceiveMessageOptions): Promise<QueueReceiveMessageResponse>;
1002
+ sendMessage(messageText: string, _options?: QueueSendMessageOptions): Promise<QueueSendMessageResponse>;
1003
+ setAccessPolicy(_identifiers?: SignedIdentifier[]): Promise<QueueSetAccessPolicyResponse>;
1004
+ setMetadata(): Promise<QueueSetMetadataResponse>;
1005
+ updateMessage(): Promise<QueueUpdateMessageResponse>;
1006
+ }
1007
+ //#endregion
1008
+ //#region src/store/MockSearchDatabase.d.ts
1009
+ export declare const MockSearchDatabase: Map<string, object[]>;
1010
+ //#endregion
1011
+ //#region src/models/search/MockSearchClient.d.ts
1012
+ /**
1013
+ * An in-memory mock of the Azure SearchClient — no emulator and no network. It applies the same OData filtering
1014
+ * as the other mock clients, so a query behaves the same here as it does against the service.
1015
+ *
1016
+ * @example
1017
+ * const mockSearchClient = new MockSearchClient(SearchIndex.Messages);
1018
+ * await mockSearchClient.uploadDocuments([{ ... }]);
1019
+ * const { count, results } = await mockSearchClient.search("*", { filter, includeTotalCount: true });
1020
+ */
1021
+ export declare class MockSearchClient<TModel extends object = Record<string, unknown>> implements Except<SearchClient<TModel>, "pipeline"> {
1022
+ readonly apiVersion: string;
1023
+ readonly endpoint: string;
1024
+ readonly indexName: string;
1025
+ readonly serviceVersion: string;
1026
+ get documents(): MapValue<typeof MockSearchDatabase>;
1027
+ constructor(indexName: string);
1028
+ autocomplete(): Promise<AutocompleteResult>;
1029
+ deleteDocuments(documents: TModel[], options?: DeleteDocumentsOptions): Promise<IndexDocumentsResult>;
1030
+ deleteDocuments(keyName: keyof TModel, keyValues: string[], options?: DeleteDocumentsOptions): Promise<IndexDocumentsResult>;
1031
+ getDocument<TFields extends SelectFields<TModel>>(_key: string, _options?: GetDocumentOptions<TModel, TFields>): Promise<NarrowedModel<TModel, TFields>>;
1032
+ getDocumentsCount(_options?: CountDocumentsOptions): Promise<number>;
1033
+ indexDocuments(_batch: IndexDocumentsBatch<TModel>, _options?: IndexDocumentsOptions): Promise<IndexDocumentsResult>;
1034
+ mergeDocuments(_documents: TModel[], _options?: MergeDocumentsOptions): Promise<IndexDocumentsResult>;
1035
+ mergeOrUploadDocuments(_documents: TModel[], _options?: MergeOrUploadDocumentsOptions): Promise<IndexDocumentsResult>;
1036
+ search<TFields extends SelectFields<TModel>>(searchText?: string, options?: SearchOptions<TModel, TFields>): Promise<SearchDocumentsResult<TModel, TFields>>;
1037
+ suggest<TFields extends SelectFields<TModel> = never>(_searchText: string, _suggesterName: string, _options?: SuggestOptions<TModel, TFields>): Promise<SuggestDocumentsResult<TModel, TFields>>;
1038
+ uploadDocuments(documents: TModel[], _options?: UploadDocumentsOptions): Promise<IndexDocumentsResult>;
1039
+ }
1040
+ //#endregion
1041
+ //#region src/store/MockServiceBusDatabase.d.ts
1042
+ export declare const MockServiceBusDatabase: Map<string, ServiceBusMessage[]>;
1043
+ //#endregion
1044
+ //#region src/models/serviceBus/MockServiceBusSender.d.ts
1045
+ /**
1046
+ * An in-memory mock of the Azure ServiceBusSender — no emulator and no network.
1047
+ *
1048
+ * @example
1049
+ * const mockServiceBusSender = new MockServiceBusSender("hello world");
1050
+ * await mockServiceBusSender.scheduleMessages({ body: "hello world" }, new Date());
1051
+ */
1052
+ export declare class MockServiceBusSender implements ServiceBusSender {
1053
+ entityPath: string;
1054
+ identifier: string;
1055
+ isClosed: boolean;
1056
+ get queue(): MapValue<typeof MockServiceBusDatabase>;
1057
+ constructor(queueName: string);
1058
+ cancelScheduledMessages(): Promise<void>;
1059
+ close(): Promise<void>;
1060
+ createMessageBatch(): Promise<ServiceBusMessageBatch>;
1061
+ scheduleMessages(messages: ServiceBusMessage | ServiceBusMessage[], scheduledEnqueueTimeUtc: Date): Promise<never[]>;
1062
+ sendMessages(messages: ServiceBusMessage | ServiceBusMessage[] | ServiceBusMessageBatch): Promise<void>;
1063
+ }
1064
+ //#endregion
1065
+ //#region src/models/shared/MockResponse.d.ts
1066
+ export interface MockResponse {
1067
+ headers: HttpHeadersLike;
1068
+ parsedHeaders: Record<string, never>;
1069
+ request: WebResourceLike;
1070
+ status: number;
1071
+ }
1072
+ //#endregion
1073
+ //#region src/models/shared/MockRestError.d.ts
1074
+ export declare class MockRestError extends RestError {
1075
+ constructor(message: string, statusCode: number);
1076
+ }
1077
+ //#endregion
1078
+ //#region src/models/shared/NotImplementedError.d.ts
1079
+ export declare class NotImplementedError extends Error {
1080
+ constructor(name: string);
1081
+ }
1082
+ //#endregion
1083
+ //#region src/store/MockTableDatabase.d.ts
1084
+ export declare const MockTableDatabase: Map<string, Map<string, TableEntity>>;
1085
+ //#endregion
1086
+ //#region src/models/table/MockTableClient.d.ts
1087
+ /**
1088
+ * An in-memory mock of the Azure TableClient — no emulator and no network.
1089
+ *
1090
+ * @example
1091
+ * const mockTableClient = new MockTableClient("", "hello world");
1092
+ * await mockTableClient.createEntity({ partitionKey: "partitionKey", rowKey: "rowKey" });
1093
+ * const entity = await mockTableClient.getEntity("partitionKey", "rowKey");
1094
+ */
1095
+ export declare class MockTableClient<TEntity extends TableEntity = TableEntity> implements Except<TableClient, "pipeline"> {
1096
+ #private;
1097
+ entityType: TEntity;
1098
+ tableName: string;
1099
+ url: string;
1100
+ get table(): MapValue<typeof MockTableDatabase>;
1101
+ constructor(_url: string, tableName: string);
1102
+ createEntity<T extends object>(entity: TableEntity<T>): Promise<CreateTableEntityResponse>;
1103
+ createTable(): Promise<void>;
1104
+ deleteEntity(partitionKey: string, rowKey: string, options?: {
1105
+ etag?: string;
1106
+ }): Promise<TableDeleteEntityHeaders>;
1107
+ deleteTable(): Promise<void>;
1108
+ getAccessPolicy(): Promise<GetAccessPolicyResponse>;
1109
+ getEntity<T extends object = Record<string, unknown>>(partitionKey: string, rowKey: string): Promise<GetTableEntityResponse<TableEntityResult<T>>>;
1110
+ listEntities<T extends object>(options?: ListTableEntitiesOptions): PagedAsyncIterableIterator<TableEntityResult<T>, TableEntityResultPage<T>>;
1111
+ setAccessPolicy(): Promise<TableSetAccessPolicyHeaders>;
1112
+ submitTransaction(actions: Parameters<TableClient["submitTransaction"]>[0]): Promise<TableTransactionResponse>;
1113
+ updateEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode, options?: {
1114
+ etag?: string;
1115
+ }): Promise<TableMergeEntityHeaders>;
1116
+ upsertEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode): Promise<TableMergeEntityHeaders>;
1117
+ }
1118
+ //#endregion
1119
+ //#region src/models/webPubSub/MockWebPubSubServiceClient.d.ts
1120
+ /**
1121
+ * A minimal mock of the Azure WebPubSubServiceClient for testing purposes.
1122
+ * Only implements `group().sendToAll` — the only method used in azure-functions tests.
1123
+ */
1124
+ export declare class MockWebPubSubServiceClient {
1125
+ group(_groupName: string): {
1126
+ sendToAll: () => Promise<void>;
1127
+ };
1128
+ }
1129
+ //#endregion
1130
+ //#region src/services/container/bodyToBuffer.d.ts
1131
+ export declare const bodyToBuffer: (body: HttpRequestBody) => Promise<Buffer>;
1132
+ //#endregion
1133
+ //#region src/services/container/checkIsReadableStream.d.ts
1134
+ export declare const checkIsReadableStream: (value: unknown) => value is NodeJS.ReadableStream;
1135
+ //#endregion
1136
+ //#region src/services/container/constants.d.ts
1137
+ export declare const MOCK_BLOB_SEEDED_DATE: Date;
1138
+ export declare const MOCK_BLOB_SEEDED_PROPERTIES: MockBlobDates;
1139
+ //#endregion
1140
+ //#region src/services/container/deleteMockBlob.d.ts
1141
+ export declare const deleteMockBlob: (containerName: string, blobName: string) => boolean;
1142
+ //#endregion
1143
+ //#region src/services/container/getAzureErrorXml.d.ts
1144
+ /**
1145
+ * Generates a standard Azure Storage error XML response body.
1146
+ * @param errorCode The official Azure error code (e.g., "BlobNotFound").
1147
+ * @param errorMessage The user-friendly error message.
1148
+ * @returns A formatted XML string.
1149
+ */
1150
+ export declare const getAzureErrorXml: (errorCode: string, errorMessage: string) => string;
1151
+ //#endregion
1152
+ //#region src/services/container/getBlobItemXml.d.ts
1153
+ export declare const getBlobItemXml: ({ name, properties }: BlobItem) => string;
1154
+ //#endregion
1155
+ //#region src/services/container/getBlobPrefixXml.d.ts
1156
+ export declare const getBlobPrefixXml: (name: string) => string;
1157
+ //#endregion
1158
+ //#region src/services/container/getBlobUrl.d.ts
1159
+ export declare const getBlobUrl: (containerName: string, blobName: string) => string;
1160
+ //#endregion
1161
+ //#region src/services/container/getBlobUrlParts.d.ts
1162
+ export declare const getBlobUrlParts: (url: string) => undefined | {
1163
+ blobName: string;
1164
+ containerName: string;
1165
+ };
1166
+ //#endregion
1167
+ //#region src/services/container/getListBlobsSegmentResponse.d.ts
1168
+ export declare const getListBlobsSegmentResponse: (containerName: string, prefix: string, segment: BlobHierarchyListSegment, blobsXml: string) => ContainerListBlobHierarchySegmentResponse;
1169
+ //#endregion
1170
+ //#region src/services/container/getListBlobsXml.d.ts
1171
+ /**
1172
+ * Generates a standard Azure Storage list blobs XML response body.
1173
+ * @param containerName The container name.
1174
+ * @param blobsXml The blobs xml data.
1175
+ * @returns A formatted XML string.
1176
+ */
1177
+ export declare const getListBlobsXml: (containerName: string, blobsXml: string) => string;
1178
+ //#endregion
1179
+ //#region src/services/container/getMockBlobKey.d.ts
1180
+ export declare const getMockBlobKey: (containerName: string, blobName: string) => string;
1181
+ //#endregion
1182
+ //#region src/services/container/getMockContainer.d.ts
1183
+ export declare const getMockContainer: (containerName: string) => MapValue<typeof MockContainerDatabase>;
1184
+ //#endregion
1185
+ //#region src/services/container/readMockBlobDates.d.ts
1186
+ export declare const readMockBlobDates: (containerName: string, blobName: string) => MockBlobDates;
1187
+ //#endregion
1188
+ //#region src/services/container/readMockBlobMetadata.d.ts
1189
+ export declare const readMockBlobMetadata: (containerName: string, blobName: string) => Record<string, string> | undefined;
1190
+ //#endregion
1191
+ //#region src/services/container/storeMockBlobMetadata.d.ts
1192
+ export declare const storeMockBlobMetadata: (containerName: string, blobName: string, metadata: Record<string, string> | undefined) => void;
1193
+ //#endregion
1194
+ //#region src/services/container/storeMockBlobWrite.d.ts
1195
+ export declare const storeMockBlobWrite: (containerName: string, blobName: string, isExisting: boolean) => void;
1196
+ //#endregion
1197
+ //#region src/services/container/toWebResourceLike.d.ts
1198
+ export declare const toWebResourceLike: (request: PipelineRequest) => WebResourceLike;
1199
+ //#endregion
1200
+ //#region src/services/filter/applyFilter.d.ts
1201
+ export declare const applyFilter: <T extends Record<string, unknown>>(documents: T[], clauses: Clause<T>[]) => T[];
1202
+ //#endregion
1203
+ //#region src/services/filter/checkIsNullClause.d.ts
1204
+ export declare const checkIsNullClause: (clause: Clause<Record<string, unknown>>) => boolean;
1205
+ //#endregion
1206
+ //#region src/services/filter/compare.d.ts
1207
+ export declare const compare: <T>(operator: BinaryOperator, leftHandSide: T, rightHandSide: null | T) => boolean;
1208
+ //#endregion
1209
+ //#region src/services/filter/createFilterPredicate.d.ts
1210
+ export declare const createFilterPredicate: (filter: string) => ((document: Record<string, unknown>) => boolean);
1211
+ //#endregion
1212
+ //#region src/services/queue/getMockQueueMessageItem.d.ts
1213
+ export declare const getMockQueueMessageItem: (messageText: string) => {
1214
+ expiresOn: Date;
1215
+ insertedOn: Date;
1216
+ messageId: string;
1217
+ messageText: string;
1218
+ };
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
1228
+ //#region src/services/table/compareByCompositeKey.d.ts
1229
+ export declare const compareByCompositeKey: (firstEntity: TableEntity, secondEntity: TableEntity) => number;
1230
+ //#endregion
1231
+ //#region src/store/MockContainerBlobDatesDatabase.d.ts
1232
+ export declare const MockContainerBlobDatesDatabase: Map<string, MockBlobDates>;
1233
+ //#endregion
1234
+ //#region src/store/MockContainerBlobMetadataDatabase.d.ts
1235
+ export declare const MockContainerBlobMetadataDatabase: Map<string, Record<string, string>>;
1236
+ //#endregion
1237
+ //#region src/store/MockEventGridDatabase.d.ts
1238
+ export declare const MockEventGridDatabase: Map<string, EventGridEvent<unknown>[]>;
1239
+ //#endregion
1240
+ export {};