azure-mock 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,839 @@
1
+ import { AnonymousCredential, AppendBlobClient, BlobAbortCopyFromURLResponse, BlobBatchClient, BlobBeginCopyFromURLResponse, BlobClient, BlobCopyFromURLResponse, BlobCreateSnapshotResponse, BlobDeleteIfExistsResponse, BlobDeleteImmutabilityPolicyResponse, BlobDeleteResponse, BlobDownloadResponseModel, BlobDownloadResponseParsed, BlobGetAccountInfoResponse, BlobGetPropertiesResponse, BlobGetTagsResponse, BlobItem, BlobLeaseClient, BlobPrefix, BlobSetHTTPHeadersResponse, BlobSetImmutabilityPolicyResponse, BlobSetLegalHoldResponse, BlobSetMetadataResponse, BlobSetTagsResponse, BlobSetTierResponse, BlobUndeleteResponse, BlobUploadCommonResponse, BlockBlobClient, BlockBlobCommitBlockListResponse, BlockBlobGetBlockListResponse, BlockBlobPutBlobFromUrlResponse, BlockBlobStageBlockFromURLResponse, BlockBlobStageBlockResponse, BlockBlobUploadResponse, ContainerClient, ContainerCreateIfNotExistsResponse, ContainerCreateResponse, ContainerDeleteIfExistsResponse, ContainerDeleteResponse, ContainerFindBlobsByTagsSegmentResponse, ContainerGetAccessPolicyResponse, ContainerGetAccountInfoResponse, ContainerGetPropertiesResponse, ContainerListBlobFlatSegmentResponse, ContainerListBlobHierarchySegmentResponse, ContainerListBlobsOptions, ContainerSetAccessPolicyResponse, ContainerSetMetadataResponse, FilterBlobItem, HttpRequestBody, PageBlobClient, PollOperationState, PollerLikeWithCancellation } from "@azure/storage-blob";
2
+ import { CreateTableEntityResponse, GetAccessPolicyResponse, GetTableEntityResponse, TableClient, TableDeleteEntityHeaders, TableEntity, TableEntityResult, TableEntityResultPage, TableMergeEntityHeaders, TableSetAccessPolicyHeaders, TableTransactionResponse, UpdateMode } from "@azure/data-tables";
3
+ import { WebResourceLike } from "@azure/core-http-compat";
4
+ import { PipelineRequest } from "@azure/core-rest-pipeline";
5
+
6
+ //#region src/models/BlobHierarchyItem.d.ts
7
+ type BlobHierarchyItem = (BlobItem & {
8
+ kind: "blob";
9
+ }) | (BlobPrefix & {
10
+ kind: "prefix";
11
+ });
12
+ //#endregion
13
+ //#region src/models/PageSettings.d.ts
14
+ /**
15
+ * An interface that tracks the settings for paged iteration
16
+ */
17
+ interface PageSettings {
18
+ /**
19
+ * The token that keeps track of where to continue the iterator
20
+ */
21
+ continuationToken?: string;
22
+ /**
23
+ * The size of the page during paged iteration
24
+ */
25
+ maxPageSize?: number;
26
+ }
27
+ //#endregion
28
+ //#region src/models/PagedAsyncIterableIterator.d.ts
29
+ /**
30
+ * An interface that allows async iterable iteration both to completion and by page.
31
+ */
32
+ interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
33
+ /**
34
+ * The connection to the async iterator, part of the iteration protocol
35
+ */
36
+ [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
37
+ /**
38
+ * Return an AsyncIterableIterator that works a page at a time
39
+ */
40
+ byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;
41
+ /**
42
+ * The next method, part of the iteration protocol
43
+ */
44
+ next(): Promise<IteratorResult<TElement>>;
45
+ }
46
+ //#endregion
47
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
48
+ declare global {
49
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
50
+ interface SymbolConstructor {
51
+ readonly observable: symbol;
52
+ }
53
+ }
54
+
55
+ /**
56
+ @remarks
57
+ The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
58
+ As well, some guidance on making an `Observable` to not include `closed` property.
59
+ @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
60
+ @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
61
+ @see https://github.com/benlesh/symbol-observable#making-an-object-observable
62
+
63
+ @category Observable
64
+ */
65
+
66
+ //#endregion
67
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
68
+ /**
69
+ Extract all optional keys from the given type.
70
+
71
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
72
+
73
+ @example
74
+ ```
75
+ import type {OptionalKeysOf, Except} from 'type-fest';
76
+
77
+ interface User {
78
+ name: string;
79
+ surname: string;
80
+
81
+ luckyNumber?: number;
82
+ }
83
+
84
+ const REMOVE_FIELD = Symbol('remove field symbol');
85
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
86
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
87
+ };
88
+
89
+ const update1: UpdateOperation<User> = {
90
+ name: 'Alice'
91
+ };
92
+
93
+ const update2: UpdateOperation<User> = {
94
+ name: 'Bob',
95
+ luckyNumber: REMOVE_FIELD
96
+ };
97
+ ```
98
+
99
+ @category Utilities
100
+ */
101
+ type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
102
+ ? (keyof { [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
103
+ : never; // Should never happen
104
+ //#endregion
105
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
106
+ /**
107
+ Extract all required keys from the given type.
108
+
109
+ 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...
110
+
111
+ @example
112
+ ```
113
+ import type {RequiredKeysOf} from 'type-fest';
114
+
115
+ declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
116
+
117
+ interface User {
118
+ name: string;
119
+ surname: string;
120
+
121
+ luckyNumber?: number;
122
+ }
123
+
124
+ const validator1 = createValidation<User>('name', value => value.length < 25);
125
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
126
+ ```
127
+
128
+ @category Utilities
129
+ */
130
+ type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
131
+ ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never; // Should never happen
132
+
133
+ //#endregion
134
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
135
+ /**
136
+ Returns a boolean for whether the given type is `never`.
137
+
138
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
139
+ @link https://stackoverflow.com/a/53984913/10292952
140
+ @link https://www.zhenghao.io/posts/ts-never
141
+
142
+ Useful in type utilities, such as checking if something does not occur.
143
+
144
+ @example
145
+ ```
146
+ import type {IsNever, And} from 'type-fest';
147
+
148
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
149
+ type AreStringsEqual<A extends string, B extends string> =
150
+ And<
151
+ IsNever<Exclude<A, B>> extends true ? true : false,
152
+ IsNever<Exclude<B, A>> extends true ? true : false
153
+ >;
154
+
155
+ type EndIfEqual<I extends string, O extends string> =
156
+ AreStringsEqual<I, O> extends true
157
+ ? never
158
+ : void;
159
+
160
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
161
+ if (input === output) {
162
+ process.exit(0);
163
+ }
164
+ }
165
+
166
+ endIfEqual('abc', 'abc');
167
+ //=> never
168
+
169
+ endIfEqual('abc', '123');
170
+ //=> void
171
+ ```
172
+
173
+ @category Type Guard
174
+ @category Utilities
175
+ */
176
+ type IsNever<T> = [T] extends [never] ? true : false;
177
+ //#endregion
178
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
179
+ /**
180
+ An if-else-like type that resolves depending on whether the given type is `never`.
181
+
182
+ @see {@link IsNever}
183
+
184
+ @example
185
+ ```
186
+ import type {IfNever} from 'type-fest';
187
+
188
+ type ShouldBeTrue = IfNever<never>;
189
+ //=> true
190
+
191
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
192
+ //=> 'bar'
193
+ ```
194
+
195
+ @category Type Guard
196
+ @category Utilities
197
+ */
198
+ type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
199
+ //#endregion
200
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
201
+ // Can eventually be replaced with the built-in once this library supports
202
+ // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
203
+ type NoInfer<T> = T extends infer U ? U : never;
204
+
205
+ /**
206
+ Returns a boolean for whether the given type is `any`.
207
+
208
+ @link https://stackoverflow.com/a/49928360/1490091
209
+
210
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
211
+
212
+ @example
213
+ ```
214
+ import type {IsAny} from 'type-fest';
215
+
216
+ const typedObject = {a: 1, b: 2} as const;
217
+ const anyObject: any = {a: 1, b: 2};
218
+
219
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
220
+ return obj[key];
221
+ }
222
+
223
+ const typedA = get(typedObject, 'a');
224
+ //=> 1
225
+
226
+ const anyA = get(anyObject, 'a');
227
+ //=> any
228
+ ```
229
+
230
+ @category Type Guard
231
+ @category Utilities
232
+ */
233
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
234
+ //#endregion
235
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-equal.d.ts
236
+ /**
237
+ Returns a boolean for whether the two given types are equal.
238
+
239
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
240
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
241
+
242
+ Use-cases:
243
+ - If you want to make a conditional branch based on the result of a comparison of two types.
244
+
245
+ @example
246
+ ```
247
+ import type {IsEqual} from 'type-fest';
248
+
249
+ // This type returns a boolean for whether the given array includes the given item.
250
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
251
+ type Includes<Value extends readonly any[], Item> =
252
+ Value extends readonly [Value[0], ...infer rest]
253
+ ? IsEqual<Value[0], Item> extends true
254
+ ? true
255
+ : Includes<rest, Item>
256
+ : false;
257
+ ```
258
+
259
+ @category Type Guard
260
+ @category Utilities
261
+ */
262
+ type IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
263
+ //#endregion
264
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
265
+ /**
266
+ 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.
267
+
268
+ @example
269
+ ```
270
+ import type {Simplify} from 'type-fest';
271
+
272
+ type PositionProps = {
273
+ top: number;
274
+ left: number;
275
+ };
276
+
277
+ type SizeProps = {
278
+ width: number;
279
+ height: number;
280
+ };
281
+
282
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
283
+ type Props = Simplify<PositionProps & SizeProps>;
284
+ ```
285
+
286
+ 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.
287
+
288
+ 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`.
289
+
290
+ @example
291
+ ```
292
+ import type {Simplify} from 'type-fest';
293
+
294
+ interface SomeInterface {
295
+ foo: number;
296
+ bar?: string;
297
+ baz: number | undefined;
298
+ }
299
+
300
+ type SomeType = {
301
+ foo: number;
302
+ bar?: string;
303
+ baz: number | undefined;
304
+ };
305
+
306
+ const literal = {foo: 123, bar: 'hello', baz: 456};
307
+ const someType: SomeType = literal;
308
+ const someInterface: SomeInterface = literal;
309
+
310
+ function fn(object: Record<string, unknown>): void {}
311
+
312
+ fn(literal); // Good: literal object type is sealed
313
+ fn(someType); // Good: type is sealed
314
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
315
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
316
+ ```
317
+
318
+ @link https://github.com/microsoft/TypeScript/issues/15300
319
+ @see SimplifyDeep
320
+ @category Object
321
+ */
322
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
323
+ //#endregion
324
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
325
+ /**
326
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
327
+
328
+ This is the counterpart of `PickIndexSignature`.
329
+
330
+ Use-cases:
331
+ - Remove overly permissive signatures from third-party types.
332
+
333
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
334
+
335
+ 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>`.
336
+
337
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
338
+
339
+ ```
340
+ const indexed: Record<string, unknown> = {}; // Allowed
341
+
342
+ const keyed: Record<'foo', unknown> = {}; // Error
343
+ // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
344
+ ```
345
+
346
+ 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:
347
+
348
+ ```
349
+ type Indexed = {} extends Record<string, unknown>
350
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
351
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
352
+ // => '✅ `{}` is assignable to `Record<string, unknown>`'
353
+
354
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
355
+ ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
356
+ : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
357
+ // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
358
+ ```
359
+
360
+ 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`...
361
+
362
+ ```
363
+ import type {OmitIndexSignature} from 'type-fest';
364
+
365
+ type OmitIndexSignature<ObjectType> = {
366
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
367
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
368
+ };
369
+ ```
370
+
371
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
372
+
373
+ ```
374
+ import type {OmitIndexSignature} from 'type-fest';
375
+
376
+ type OmitIndexSignature<ObjectType> = {
377
+ [KeyType in keyof ObjectType
378
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
379
+ as {} extends Record<KeyType, unknown>
380
+ ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
381
+ : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
382
+ ]: ObjectType[KeyType];
383
+ };
384
+ ```
385
+
386
+ 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.
387
+
388
+ @example
389
+ ```
390
+ import type {OmitIndexSignature} from 'type-fest';
391
+
392
+ interface Example {
393
+ // These index signatures will be removed.
394
+ [x: string]: any
395
+ [x: number]: any
396
+ [x: symbol]: any
397
+ [x: `head-${string}`]: string
398
+ [x: `${string}-tail`]: string
399
+ [x: `head-${string}-tail`]: string
400
+ [x: `${bigint}`]: string
401
+ [x: `embedded-${number}`]: string
402
+
403
+ // These explicitly defined keys will remain.
404
+ foo: 'bar';
405
+ qux?: 'baz';
406
+ }
407
+
408
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
409
+ // => { foo: 'bar'; qux?: 'baz' | undefined; }
410
+ ```
411
+
412
+ @see PickIndexSignature
413
+ @category Object
414
+ */
415
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
416
+ //#endregion
417
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
418
+ /**
419
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
420
+
421
+ This is the counterpart of `OmitIndexSignature`.
422
+
423
+ @example
424
+ ```
425
+ import type {PickIndexSignature} from 'type-fest';
426
+
427
+ declare const symbolKey: unique symbol;
428
+
429
+ type Example = {
430
+ // These index signatures will remain.
431
+ [x: string]: unknown;
432
+ [x: number]: unknown;
433
+ [x: symbol]: unknown;
434
+ [x: `head-${string}`]: string;
435
+ [x: `${string}-tail`]: string;
436
+ [x: `head-${string}-tail`]: string;
437
+ [x: `${bigint}`]: string;
438
+ [x: `embedded-${number}`]: string;
439
+
440
+ // These explicitly defined keys will be removed.
441
+ ['kebab-case-key']: string;
442
+ [symbolKey]: string;
443
+ foo: 'bar';
444
+ qux?: 'baz';
445
+ };
446
+
447
+ type ExampleIndexSignature = PickIndexSignature<Example>;
448
+ // {
449
+ // [x: string]: unknown;
450
+ // [x: number]: unknown;
451
+ // [x: symbol]: unknown;
452
+ // [x: `head-${string}`]: string;
453
+ // [x: `${string}-tail`]: string;
454
+ // [x: `head-${string}-tail`]: string;
455
+ // [x: `${bigint}`]: string;
456
+ // [x: `embedded-${number}`]: string;
457
+ // }
458
+ ```
459
+
460
+ @see OmitIndexSignature
461
+ @category Object
462
+ */
463
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
464
+ //#endregion
465
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
466
+ // Merges two objects without worrying about index signatures.
467
+ type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
468
+
469
+ /**
470
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
471
+
472
+ @example
473
+ ```
474
+ import type {Merge} from 'type-fest';
475
+
476
+ interface Foo {
477
+ [x: string]: unknown;
478
+ [x: number]: unknown;
479
+ foo: string;
480
+ bar: symbol;
481
+ }
482
+
483
+ type Bar = {
484
+ [x: number]: number;
485
+ [x: symbol]: unknown;
486
+ bar: Date;
487
+ baz: boolean;
488
+ };
489
+
490
+ export type FooBar = Merge<Foo, Bar>;
491
+ // => {
492
+ // [x: string]: unknown;
493
+ // [x: number]: number;
494
+ // [x: symbol]: unknown;
495
+ // foo: string;
496
+ // bar: Date;
497
+ // baz: boolean;
498
+ // }
499
+ ```
500
+
501
+ @category Object
502
+ */
503
+ type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
504
+ //#endregion
505
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
506
+ /**
507
+ An if-else-like type that resolves depending on whether the given type is `any`.
508
+
509
+ @see {@link IsAny}
510
+
511
+ @example
512
+ ```
513
+ import type {IfAny} from 'type-fest';
514
+
515
+ type ShouldBeTrue = IfAny<any>;
516
+ //=> true
517
+
518
+ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
519
+ //=> 'bar'
520
+ ```
521
+
522
+ @category Type Guard
523
+ @category Utilities
524
+ */
525
+ type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
526
+ //#endregion
527
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
528
+ /**
529
+ Merges user specified options with default options.
530
+
531
+ @example
532
+ ```
533
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
534
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
535
+ type SpecifiedOptions = {leavesOnly: true};
536
+
537
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
538
+ //=> {maxRecursionDepth: 10; leavesOnly: true}
539
+ ```
540
+
541
+ @example
542
+ ```
543
+ // Complains if default values are not provided for optional options
544
+
545
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
546
+ type DefaultPathsOptions = {maxRecursionDepth: 10};
547
+ type SpecifiedOptions = {};
548
+
549
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
550
+ // ~~~~~~~~~~~~~~~~~~~
551
+ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
552
+ ```
553
+
554
+ @example
555
+ ```
556
+ // Complains if an option's default type does not conform to the expected type
557
+
558
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
559
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
560
+ type SpecifiedOptions = {};
561
+
562
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
563
+ // ~~~~~~~~~~~~~~~~~~~
564
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
565
+ ```
566
+
567
+ @example
568
+ ```
569
+ // Complains if an option's specified type does not conform to the expected type
570
+
571
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
572
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
573
+ type SpecifiedOptions = {leavesOnly: 'yes'};
574
+
575
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
576
+ // ~~~~~~~~~~~~~~~~
577
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
578
+ ```
579
+ */
580
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny<SpecifiedOptions, Defaults, IfNever<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
581
+ >>;
582
+ //#endregion
583
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/except.d.ts
584
+ /**
585
+ Filter out keys from an object.
586
+
587
+ Returns `never` if `Exclude` is strictly equal to `Key`.
588
+ Returns `never` if `Key` extends `Exclude`.
589
+ Returns `Key` otherwise.
590
+
591
+ @example
592
+ ```
593
+ type Filtered = Filter<'foo', 'foo'>;
594
+ //=> never
595
+ ```
596
+
597
+ @example
598
+ ```
599
+ type Filtered = Filter<'bar', string>;
600
+ //=> never
601
+ ```
602
+
603
+ @example
604
+ ```
605
+ type Filtered = Filter<'bar', 'foo'>;
606
+ //=> 'bar'
607
+ ```
608
+
609
+ @see {Except}
610
+ */
611
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
612
+ type ExceptOptions = {
613
+ /**
614
+ Disallow assigning non-specified properties.
615
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
616
+ @default false
617
+ */
618
+ requireExactProps?: boolean;
619
+ };
620
+ type DefaultExceptOptions = {
621
+ requireExactProps: false;
622
+ };
623
+
624
+ /**
625
+ Create a type from an object type without certain keys.
626
+
627
+ We recommend setting the `requireExactProps` option to `true`.
628
+
629
+ 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.
630
+
631
+ 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)).
632
+
633
+ @example
634
+ ```
635
+ import type {Except} from 'type-fest';
636
+
637
+ type Foo = {
638
+ a: number;
639
+ b: string;
640
+ };
641
+
642
+ type FooWithoutA = Except<Foo, 'a'>;
643
+ //=> {b: string}
644
+
645
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
646
+ //=> errors: 'a' does not exist in type '{ b: string; }'
647
+
648
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
649
+ //=> {a: number} & Partial<Record<"b", never>>
650
+
651
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
652
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
653
+
654
+ // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
655
+
656
+ // Consider the following example:
657
+
658
+ type UserData = {
659
+ [metadata: string]: string;
660
+ email: string;
661
+ name: string;
662
+ role: 'admin' | 'user';
663
+ };
664
+
665
+ // `Omit` clearly doesn't behave as expected in this case:
666
+ type PostPayload = Omit<UserData, 'email'>;
667
+ //=> type PostPayload = { [x: string]: string; [x: number]: string; }
668
+
669
+ // In situations like this, `Except` works better.
670
+ // It simply removes the `email` key while preserving all the other keys.
671
+ type PostPayload = Except<UserData, 'email'>;
672
+ //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; }
673
+ ```
674
+
675
+ @category Object
676
+ */
677
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
678
+ 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>> : {});
679
+ //#endregion
680
+ //#region src/models/MockContainerClient.d.ts
681
+ /**
682
+ * An in-memory mock of the Azure ContainerClient.
683
+ * It uses a Map to simulate blob storage.
684
+ *
685
+ * @example
686
+ * const mockContainerClient = new MockContainerClient("", "hello world");
687
+ * const blockBlobClient = mockContainerClient.getBlockBlobClient("hello world.txt");
688
+ * await blockBlobClient.upload("hello world", 11);
689
+ * const content = await blockBlobClient.downloadToBuffer();
690
+ */
691
+ declare class MockContainerClient implements Except<ContainerClient, "accountName"> {
692
+ blobs: Map<string, Buffer>;
693
+ containerName: string;
694
+ credential: AnonymousCredential;
695
+ url: string;
696
+ constructor(_connectionString: string, containerName: string);
697
+ create(): Promise<ContainerCreateResponse>;
698
+ createIfNotExists(): Promise<ContainerCreateIfNotExistsResponse>;
699
+ delete(): Promise<ContainerDeleteResponse>;
700
+ deleteBlob(): Promise<BlobDeleteResponse>;
701
+ deleteIfExists(): Promise<ContainerDeleteIfExistsResponse>;
702
+ exists(): Promise<boolean>;
703
+ findBlobsByTags(): PagedAsyncIterableIterator<FilterBlobItem, ContainerFindBlobsByTagsSegmentResponse>;
704
+ generateSasStringToSign(): string;
705
+ generateSasUrl(): Promise<string>;
706
+ generateUserDelegationSasStringToSign(): string;
707
+ generateUserDelegationSasUrl(): Promise<string>;
708
+ getAccessPolicy(): Promise<ContainerGetAccessPolicyResponse>;
709
+ getAccountInfo(): Promise<ContainerGetAccountInfoResponse>;
710
+ getAppendBlobClient(): AppendBlobClient;
711
+ getBlobBatchClient(): BlobBatchClient;
712
+ getBlobClient(): BlobClient;
713
+ getBlobLeaseClient(): BlobLeaseClient;
714
+ getBlockBlobClient(blobName: string): BlockBlobClient;
715
+ getPageBlobClient(): PageBlobClient;
716
+ getProperties(): Promise<ContainerGetPropertiesResponse>;
717
+ listBlobsByHierarchy(delimiter: string, options?: ContainerListBlobsOptions): PagedAsyncIterableIterator<BlobHierarchyItem, ContainerListBlobHierarchySegmentResponse>;
718
+ listBlobsFlat(): PagedAsyncIterableIterator<BlobItem, ContainerListBlobFlatSegmentResponse>;
719
+ setAccessPolicy(): Promise<ContainerSetAccessPolicyResponse>;
720
+ setMetadata(): Promise<ContainerSetMetadataResponse>;
721
+ uploadBlockBlob(blobName: string, body: HttpRequestBody, contentLength: number): Promise<{
722
+ blockBlobClient: BlockBlobClient;
723
+ response: BlockBlobUploadResponse;
724
+ }>;
725
+ private getBlobHierarchyItemIterator;
726
+ private getBlobItemIterator;
727
+ }
728
+ //#endregion
729
+ //#region src/models/MockBlockBlobClient.d.ts
730
+ declare class MockBlockBlobClient implements Except<BlockBlobClient, "accountName"> {
731
+ containerClient: MockContainerClient;
732
+ credential: AnonymousCredential;
733
+ name: string;
734
+ url: string;
735
+ get containerName(): string;
736
+ constructor(_connectionString: string, containerClient: MockContainerClient, blobName: string);
737
+ abortCopyFromURL(): Promise<BlobAbortCopyFromURLResponse>;
738
+ beginCopyFromURL(): Promise<PollerLikeWithCancellation<PollOperationState<BlobBeginCopyFromURLResponse>, BlobBeginCopyFromURLResponse>>;
739
+ commitBlockList(): Promise<BlockBlobCommitBlockListResponse>;
740
+ createSnapshot(): Promise<BlobCreateSnapshotResponse>;
741
+ delete(): Promise<BlobDeleteResponse>;
742
+ deleteIfExists(): Promise<BlobDeleteIfExistsResponse>;
743
+ deleteImmutabilityPolicy(): Promise<BlobDeleteImmutabilityPolicyResponse>;
744
+ download(): Promise<BlobDownloadResponseParsed>;
745
+ downloadToBuffer(): Promise<Buffer>;
746
+ downloadToFile(): Promise<BlobDownloadResponseParsed>;
747
+ exists(): Promise<boolean>;
748
+ generateSasStringToSign(): string;
749
+ generateSasUrl(): Promise<string>;
750
+ generateUserDelegationSasStringToSign(): string;
751
+ generateUserDelegationSasUrl(): Promise<string>;
752
+ getAccountInfo(): Promise<BlobGetAccountInfoResponse>;
753
+ getAppendBlobClient(): AppendBlobClient;
754
+ getBlobLeaseClient(): BlobLeaseClient;
755
+ getBlockBlobClient(): BlockBlobClient;
756
+ getBlockList(): Promise<BlockBlobGetBlockListResponse>;
757
+ getPageBlobClient(): PageBlobClient;
758
+ getProperties(): Promise<BlobGetPropertiesResponse>;
759
+ getTags(): Promise<BlobGetTagsResponse>;
760
+ query(): Promise<BlobDownloadResponseModel>;
761
+ setAccessTier(): Promise<BlobSetTierResponse>;
762
+ setHTTPHeaders(): Promise<BlobSetHTTPHeadersResponse>;
763
+ setImmutabilityPolicy(): Promise<BlobSetImmutabilityPolicyResponse>;
764
+ setLegalHold(): Promise<BlobSetLegalHoldResponse>;
765
+ setMetadata(): Promise<BlobSetMetadataResponse>;
766
+ setTags(): Promise<BlobSetTagsResponse>;
767
+ stageBlock(): Promise<BlockBlobStageBlockResponse>;
768
+ stageBlockFromURL(): Promise<BlockBlobStageBlockFromURLResponse>;
769
+ syncCopyFromURL(): Promise<BlobCopyFromURLResponse>;
770
+ syncUploadFromURL(): Promise<BlockBlobPutBlobFromUrlResponse>;
771
+ undelete(): Promise<BlobUndeleteResponse>;
772
+ upload(body: HttpRequestBody, _contentLength: number): Promise<BlockBlobUploadResponse>;
773
+ uploadBrowserData(): Promise<BlobUploadCommonResponse>;
774
+ uploadData(): Promise<BlobUploadCommonResponse>;
775
+ uploadFile(): Promise<BlobUploadCommonResponse>;
776
+ uploadStream(): Promise<BlobUploadCommonResponse>;
777
+ withSnapshot(): BlockBlobClient;
778
+ withVersion(): BlobClient;
779
+ }
780
+ //#endregion
781
+ //#region src/models/MockRestError.d.ts
782
+ // A mock error class that mimics the structure of Azure's RestError
783
+ // This allows you to test error handling more realistically.
784
+ declare class MockRestError extends Error {
785
+ statusCode: number;
786
+ constructor(message: string, statusCode: number);
787
+ }
788
+ //#endregion
789
+ //#region src/models/MockTableClient.d.ts
790
+ /**
791
+ * An in-memory mock of the Azure TableClient.
792
+ * It uses a Map to simulate table storage and correctly implements the TableClient interface.
793
+ *
794
+ * @example
795
+ * const mockTableClient = new MockTableClient("", "hello world");
796
+ * await mockTableClient.createEntity({ partitionKey: "partitionKey", rowKey: "rowKey" });
797
+ * const entity = await mockTableClient.getEntity("partitionKey", "rowKey");
798
+ */
799
+ declare class MockTableClient implements Except<TableClient, "pipeline"> {
800
+ entities: Map<string, TableEntity>;
801
+ tableName: string;
802
+ url: string;
803
+ constructor(_url: string, tableName: string);
804
+ createEntity<T extends object>(entity: TableEntity<T>): Promise<CreateTableEntityResponse>;
805
+ createTable(): Promise<void>;
806
+ deleteEntity(partitionKey: string, rowKey: string): Promise<TableDeleteEntityHeaders>;
807
+ deleteTable(): Promise<void>;
808
+ getAccessPolicy(): Promise<GetAccessPolicyResponse>;
809
+ getEntity<T extends object = Record<string, unknown>>(partitionKey: string, rowKey: string): Promise<GetTableEntityResponse<TableEntityResult<T>>>;
810
+ listEntities<T extends object>(): PagedAsyncIterableIterator<TableEntityResult<T>, TableEntityResultPage<T>>;
811
+ setAccessPolicy(): Promise<TableSetAccessPolicyHeaders>;
812
+ submitTransaction(): Promise<TableTransactionResponse>;
813
+ updateEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode): Promise<TableMergeEntityHeaders>;
814
+ upsertEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode): Promise<TableMergeEntityHeaders>;
815
+ private getCompositeKey;
816
+ private mergeEntity;
817
+ // Helper to add mock metadata, similar to the real SDK
818
+ private withMetadata;
819
+ }
820
+ //#endregion
821
+ //#region src/util/bodyToBuffer.d.ts
822
+ declare const bodyToBuffer: (body: HttpRequestBody) => Promise<Buffer>;
823
+ //#endregion
824
+ //#region src/util/getBlobItemXml.d.ts
825
+ declare const getBlobItemXml: ({
826
+ name,
827
+ properties
828
+ }: BlobItem) => string;
829
+ //#endregion
830
+ //#region src/util/getBlobPrefixXml.d.ts
831
+ declare const getBlobPrefixXml: (name: string) => string;
832
+ //#endregion
833
+ //#region src/util/isReadableStream.d.ts
834
+ declare const isReadableStream: (value: unknown) => value is NodeJS.ReadableStream;
835
+ //#endregion
836
+ //#region src/util/toWebResourceLike.d.ts
837
+ declare const toWebResourceLike: (request: PipelineRequest) => WebResourceLike;
838
+ //#endregion
839
+ export { BlobHierarchyItem, MockBlockBlobClient, MockContainerClient, MockRestError, MockTableClient, PageSettings, PagedAsyncIterableIterator, bodyToBuffer, getBlobItemXml, getBlobPrefixXml, isReadableStream, toWebResourceLike };