azure-mock 4.3.1 → 4.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -132
- package/dist/index.js +47 -94
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { QueueClearMessagesResponse, QueueClient, QueueCreateIfNotExistsResponse
|
|
|
7
7
|
import { AutocompleteResult, CountDocumentsOptions, DeleteDocumentsOptions, GetDocumentOptions, IndexDocumentsBatch, IndexDocumentsOptions, IndexDocumentsResult, MergeDocumentsOptions, MergeOrUploadDocumentsOptions, NarrowedModel, SearchClient, SearchDocumentsResult, SearchOptions, SelectFields, SuggestDocumentsResult, SuggestOptions, UploadDocumentsOptions } from "@azure/search-documents";
|
|
8
8
|
import { ServiceBusMessage, ServiceBusMessageBatch, ServiceBusSender } from "@azure/service-bus";
|
|
9
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
10
|
export declare const BLOB_NOT_FOUND_ERROR_CODE = "BlobNotFound";
|
|
12
11
|
export declare const BLOB_NOT_FOUND_MESSAGE = "The specified blob does not exist.";
|
|
13
12
|
export declare const CONDITION_NOT_MET_ERROR_CODE = "ConditionNotMet";
|
|
@@ -16,21 +15,13 @@ export declare const MOCK_BLOB_BASE_URL = "https://mockaccount.blob.core.windows
|
|
|
16
15
|
export declare const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
|
|
17
16
|
export declare const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
|
|
18
17
|
export declare const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/models/container/BlobHierarchyItem.d.ts
|
|
21
18
|
export type BlobHierarchyItem = (BlobItem & {
|
|
22
19
|
kind: "blob";
|
|
23
20
|
}) | (BlobPrefix & {
|
|
24
21
|
kind: "prefix";
|
|
25
22
|
});
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/store/MockContainerDatabase.d.ts
|
|
28
23
|
export declare const MockContainerDatabase: Map<string, Map<string, Buffer>>;
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/util/types/MapValue.d.ts
|
|
31
24
|
export type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/models/container/MockBlobBatchClient.d.ts
|
|
34
25
|
export declare class MockBlobBatchClient implements BlobBatchClient {
|
|
35
26
|
#private;
|
|
36
27
|
url: string;
|
|
@@ -44,8 +35,6 @@ export declare class MockBlobBatchClient implements BlobBatchClient {
|
|
|
44
35
|
deleteBlobs(urls: string[], credential: AnonymousCredential | StorageSharedKeyCredential, options?: BlobDeleteOptions): Promise<BlobBatchDeleteBlobsResponse>;
|
|
45
36
|
getContainer(containerName: string): MapValue<typeof MockContainerDatabase>;
|
|
46
37
|
}
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-any.d.ts
|
|
49
38
|
/**
|
|
50
39
|
Returns a boolean for whether the given type is `any`.
|
|
51
40
|
|
|
@@ -75,8 +64,6 @@ const anyA = get(anyObject, 'a');
|
|
|
75
64
|
@category Utilities
|
|
76
65
|
*/
|
|
77
66
|
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
67
|
/**
|
|
81
68
|
Returns a boolean for whether the given key is an optional key of type.
|
|
82
69
|
|
|
@@ -118,8 +105,6 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
118
105
|
@category Utilities
|
|
119
106
|
*/
|
|
120
107
|
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
108
|
/**
|
|
124
109
|
Extract all optional keys from the given type.
|
|
125
110
|
|
|
@@ -156,8 +141,6 @@ const update2: UpdateOperation<User> = {
|
|
|
156
141
|
type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
157
142
|
? (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
143
|
: 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
144
|
/**
|
|
162
145
|
Extract all required keys from the given type.
|
|
163
146
|
|
|
@@ -190,8 +173,6 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
|
190
173
|
*/
|
|
191
174
|
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
192
175
|
? 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
176
|
/**
|
|
196
177
|
Returns a boolean for whether the given type is `never`.
|
|
197
178
|
|
|
@@ -246,8 +227,6 @@ type B = IsTrueFixed<never>;
|
|
|
246
227
|
@category Utilities
|
|
247
228
|
*/
|
|
248
229
|
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
230
|
/**
|
|
252
231
|
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
253
232
|
|
|
@@ -341,8 +320,6 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
|
341
320
|
@category Utilities
|
|
342
321
|
*/
|
|
343
322
|
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
323
|
/**
|
|
347
324
|
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
325
|
|
|
@@ -402,8 +379,6 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
402
379
|
@category Object
|
|
403
380
|
*/
|
|
404
381
|
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
382
|
/**
|
|
408
383
|
Returns a boolean for whether the two given types are equal.
|
|
409
384
|
|
|
@@ -433,8 +408,6 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
433
408
|
type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
|
|
434
409
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
435
410
|
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
411
|
/**
|
|
439
412
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
440
413
|
|
|
@@ -527,8 +500,6 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
527
500
|
@category Object
|
|
528
501
|
*/
|
|
529
502
|
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
503
|
/**
|
|
533
504
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
534
505
|
|
|
@@ -575,8 +546,6 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
575
546
|
@category Object
|
|
576
547
|
*/
|
|
577
548
|
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
549
|
// Merges two objects without worrying about index signatures.
|
|
581
550
|
type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
|
|
582
551
|
/**
|
|
@@ -646,8 +615,6 @@ type Merge<Destination, Source> = Destination extends unknown // For distributin
|
|
|
646
615
|
? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
|
|
647
616
|
: never; // Should never happen
|
|
648
617
|
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
618
|
/**
|
|
652
619
|
Merges user specified options with default options.
|
|
653
620
|
|
|
@@ -703,8 +670,6 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
703
670
|
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
671
|
) ? Result : never;
|
|
705
672
|
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
673
|
/**
|
|
709
674
|
Filter out keys from an object.
|
|
710
675
|
|
|
@@ -803,8 +768,6 @@ type PostPayloadFixed = Except<UserData, 'email'>;
|
|
|
803
768
|
*/
|
|
804
769
|
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
805
770
|
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
771
|
export declare class MockBlobClient implements Except<BlobClient, "accountName"> {
|
|
809
772
|
connectionString: string;
|
|
810
773
|
containerName: string;
|
|
@@ -845,15 +808,11 @@ export declare class MockBlobClient implements Except<BlobClient, "accountName">
|
|
|
845
808
|
withSnapshot(): BlockBlobClient;
|
|
846
809
|
withVersion(): BlobClient;
|
|
847
810
|
}
|
|
848
|
-
//#endregion
|
|
849
|
-
//#region src/models/container/MockBlobDates.d.ts
|
|
850
811
|
export interface MockBlobDates {
|
|
851
812
|
createdOn: Date;
|
|
852
813
|
etag: string;
|
|
853
814
|
lastModified: Date;
|
|
854
815
|
}
|
|
855
|
-
//#endregion
|
|
856
|
-
//#region src/models/container/MockBlockBlobClient.d.ts
|
|
857
816
|
export declare class MockBlockBlobClient extends MockBlobClient implements Except<BlockBlobClient, "accountName"> {
|
|
858
817
|
commitBlockList(): Promise<BlockBlobCommitBlockListResponse>;
|
|
859
818
|
getBlockList(): Promise<BlockBlobGetBlockListResponse>;
|
|
@@ -867,8 +826,6 @@ export declare class MockBlockBlobClient extends MockBlobClient implements Excep
|
|
|
867
826
|
uploadFile(): Promise<BlobUploadCommonResponse>;
|
|
868
827
|
uploadStream(): Promise<BlobUploadCommonResponse>;
|
|
869
828
|
}
|
|
870
|
-
//#endregion
|
|
871
|
-
//#region src/models/shared/PageSettings.d.ts
|
|
872
829
|
/**
|
|
873
830
|
* An interface that tracks the settings for paged iteration
|
|
874
831
|
*/
|
|
@@ -882,8 +839,6 @@ export interface PageSettings {
|
|
|
882
839
|
*/
|
|
883
840
|
maxPageSize?: number;
|
|
884
841
|
}
|
|
885
|
-
//#endregion
|
|
886
|
-
//#region src/models/shared/PagedAsyncIterableIterator.d.ts
|
|
887
842
|
/**
|
|
888
843
|
* An interface that allows async iterable iteration both to completion and by page.
|
|
889
844
|
*/
|
|
@@ -901,8 +856,6 @@ export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageS
|
|
|
901
856
|
*/
|
|
902
857
|
next: () => Promise<IteratorResult<TElement>>;
|
|
903
858
|
}
|
|
904
|
-
//#endregion
|
|
905
|
-
//#region src/models/container/MockContainerClient.d.ts
|
|
906
859
|
/**
|
|
907
860
|
* An in-memory mock of the Azure ContainerClient — no emulator and no network.
|
|
908
861
|
*
|
|
@@ -949,8 +902,6 @@ export declare class MockContainerClient implements Except<ContainerClient, "acc
|
|
|
949
902
|
response: BlockBlobUploadResponse;
|
|
950
903
|
}>;
|
|
951
904
|
}
|
|
952
|
-
//#endregion
|
|
953
|
-
//#region src/models/eventGrid/MockEventGridPublisherClient.d.ts
|
|
954
905
|
/**
|
|
955
906
|
* An in-memory mock of the Azure EventGridPublisherClient — no emulator and no network.
|
|
956
907
|
* `client` is excluded because it is a private member of the real class and cannot be satisfied structurally.
|
|
@@ -962,11 +913,7 @@ export declare class MockEventGridPublisherClient implements Except<EventGridPub
|
|
|
962
913
|
constructor(endpoint: string, topicType: "EventGrid");
|
|
963
914
|
send(newEvents: EventGridEvent<unknown>[]): Promise<void>;
|
|
964
915
|
}
|
|
965
|
-
//#endregion
|
|
966
|
-
//#region src/store/MockQueueDatabase.d.ts
|
|
967
916
|
export declare const MockQueueDatabase: Map<string, string[]>;
|
|
968
|
-
//#endregion
|
|
969
|
-
//#region src/models/queue/MockQueueClient.d.ts
|
|
970
917
|
/**
|
|
971
918
|
* An in-memory mock of the Azure QueueClient — no emulator and no network.
|
|
972
919
|
*
|
|
@@ -1004,11 +951,7 @@ export declare class MockQueueClient implements Except<QueueClient, "accountName
|
|
|
1004
951
|
setMetadata(): Promise<QueueSetMetadataResponse>;
|
|
1005
952
|
updateMessage(): Promise<QueueUpdateMessageResponse>;
|
|
1006
953
|
}
|
|
1007
|
-
//#endregion
|
|
1008
|
-
//#region src/store/MockSearchDatabase.d.ts
|
|
1009
954
|
export declare const MockSearchDatabase: Map<string, object[]>;
|
|
1010
|
-
//#endregion
|
|
1011
|
-
//#region src/models/search/MockSearchClient.d.ts
|
|
1012
955
|
/**
|
|
1013
956
|
* An in-memory mock of the Azure SearchClient — no emulator and no network. It applies the same OData filtering
|
|
1014
957
|
* as the other mock clients, so a query behaves the same here as it does against the service.
|
|
@@ -1037,11 +980,7 @@ export declare class MockSearchClient<TModel extends object = Record<string, unk
|
|
|
1037
980
|
suggest<TFields extends SelectFields<TModel> = never>(_searchText: string, _suggesterName: string, _options?: SuggestOptions<TModel, TFields>): Promise<SuggestDocumentsResult<TModel, TFields>>;
|
|
1038
981
|
uploadDocuments(documents: TModel[], _options?: UploadDocumentsOptions): Promise<IndexDocumentsResult>;
|
|
1039
982
|
}
|
|
1040
|
-
//#endregion
|
|
1041
|
-
//#region src/store/MockServiceBusDatabase.d.ts
|
|
1042
983
|
export declare const MockServiceBusDatabase: Map<string, ServiceBusMessage[]>;
|
|
1043
|
-
//#endregion
|
|
1044
|
-
//#region src/models/serviceBus/MockServiceBusSender.d.ts
|
|
1045
984
|
/**
|
|
1046
985
|
* An in-memory mock of the Azure ServiceBusSender — no emulator and no network.
|
|
1047
986
|
*
|
|
@@ -1061,29 +1000,19 @@ export declare class MockServiceBusSender implements ServiceBusSender {
|
|
|
1061
1000
|
scheduleMessages(messages: ServiceBusMessage | ServiceBusMessage[], scheduledEnqueueTimeUtc: Date): Promise<never[]>;
|
|
1062
1001
|
sendMessages(messages: ServiceBusMessage | ServiceBusMessage[] | ServiceBusMessageBatch): Promise<void>;
|
|
1063
1002
|
}
|
|
1064
|
-
//#endregion
|
|
1065
|
-
//#region src/models/shared/MockResponse.d.ts
|
|
1066
1003
|
export interface MockResponse {
|
|
1067
1004
|
headers: HttpHeadersLike;
|
|
1068
1005
|
parsedHeaders: Record<string, never>;
|
|
1069
1006
|
request: WebResourceLike;
|
|
1070
1007
|
status: number;
|
|
1071
1008
|
}
|
|
1072
|
-
//#endregion
|
|
1073
|
-
//#region src/models/shared/MockRestError.d.ts
|
|
1074
1009
|
export declare class MockRestError extends RestError {
|
|
1075
1010
|
constructor(message: string, statusCode: number);
|
|
1076
1011
|
}
|
|
1077
|
-
//#endregion
|
|
1078
|
-
//#region src/models/shared/NotImplementedError.d.ts
|
|
1079
1012
|
export declare class NotImplementedError extends Error {
|
|
1080
1013
|
constructor(name: string);
|
|
1081
1014
|
}
|
|
1082
|
-
//#endregion
|
|
1083
|
-
//#region src/store/MockTableDatabase.d.ts
|
|
1084
1015
|
export declare const MockTableDatabase: Map<string, Map<string, TableEntity>>;
|
|
1085
|
-
//#endregion
|
|
1086
|
-
//#region src/models/table/MockTableClient.d.ts
|
|
1087
1016
|
/**
|
|
1088
1017
|
* An in-memory mock of the Azure TableClient — no emulator and no network.
|
|
1089
1018
|
*
|
|
@@ -1115,8 +1044,6 @@ export declare class MockTableClient<TEntity extends TableEntity = TableEntity>
|
|
|
1115
1044
|
}): Promise<TableMergeEntityHeaders>;
|
|
1116
1045
|
upsertEntity<T extends object>(entity: TableEntity<T>, mode?: UpdateMode): Promise<TableMergeEntityHeaders>;
|
|
1117
1046
|
}
|
|
1118
|
-
//#endregion
|
|
1119
|
-
//#region src/models/webPubSub/MockWebPubSubServiceClient.d.ts
|
|
1120
1047
|
/**
|
|
1121
1048
|
* A minimal mock of the Azure WebPubSubServiceClient for testing purposes.
|
|
1122
1049
|
* Only implements `group().sendToAll` — the only method used in azure-functions tests.
|
|
@@ -1126,21 +1053,11 @@ export declare class MockWebPubSubServiceClient {
|
|
|
1126
1053
|
sendToAll: () => Promise<void>;
|
|
1127
1054
|
};
|
|
1128
1055
|
}
|
|
1129
|
-
//#endregion
|
|
1130
|
-
//#region src/services/container/bodyToBuffer.d.ts
|
|
1131
1056
|
export declare const bodyToBuffer: (body: HttpRequestBody) => Promise<Buffer>;
|
|
1132
|
-
//#endregion
|
|
1133
|
-
//#region src/services/container/checkIsReadableStream.d.ts
|
|
1134
1057
|
export declare const checkIsReadableStream: (value: unknown) => value is NodeJS.ReadableStream;
|
|
1135
|
-
//#endregion
|
|
1136
|
-
//#region src/services/container/constants.d.ts
|
|
1137
1058
|
export declare const MOCK_BLOB_SEEDED_DATE: Date;
|
|
1138
1059
|
export declare const MOCK_BLOB_SEEDED_PROPERTIES: MockBlobDates;
|
|
1139
|
-
//#endregion
|
|
1140
|
-
//#region src/services/container/deleteMockBlob.d.ts
|
|
1141
1060
|
export declare const deleteMockBlob: (containerName: string, blobName: string) => boolean;
|
|
1142
|
-
//#endregion
|
|
1143
|
-
//#region src/services/container/getAzureErrorXml.d.ts
|
|
1144
1061
|
/**
|
|
1145
1062
|
* Generates a standard Azure Storage error XML response body.
|
|
1146
1063
|
* @param errorCode The official Azure error code (e.g., "BlobNotFound").
|
|
@@ -1148,26 +1065,14 @@ export declare const deleteMockBlob: (containerName: string, blobName: string) =
|
|
|
1148
1065
|
* @returns A formatted XML string.
|
|
1149
1066
|
*/
|
|
1150
1067
|
export declare const getAzureErrorXml: (errorCode: string, errorMessage: string) => string;
|
|
1151
|
-
//#endregion
|
|
1152
|
-
//#region src/services/container/getBlobItemXml.d.ts
|
|
1153
1068
|
export declare const getBlobItemXml: ({ name, properties }: BlobItem) => string;
|
|
1154
|
-
//#endregion
|
|
1155
|
-
//#region src/services/container/getBlobPrefixXml.d.ts
|
|
1156
1069
|
export declare const getBlobPrefixXml: (name: string) => string;
|
|
1157
|
-
//#endregion
|
|
1158
|
-
//#region src/services/container/getBlobUrl.d.ts
|
|
1159
1070
|
export declare const getBlobUrl: (containerName: string, blobName: string) => string;
|
|
1160
|
-
//#endregion
|
|
1161
|
-
//#region src/services/container/getBlobUrlParts.d.ts
|
|
1162
1071
|
export declare const getBlobUrlParts: (url: string) => undefined | {
|
|
1163
1072
|
blobName: string;
|
|
1164
1073
|
containerName: string;
|
|
1165
1074
|
};
|
|
1166
|
-
//#endregion
|
|
1167
|
-
//#region src/services/container/getListBlobsSegmentResponse.d.ts
|
|
1168
1075
|
export declare const getListBlobsSegmentResponse: (containerName: string, prefix: string, segment: BlobHierarchyListSegment, blobsXml: string) => ContainerListBlobHierarchySegmentResponse;
|
|
1169
|
-
//#endregion
|
|
1170
|
-
//#region src/services/container/getListBlobsXml.d.ts
|
|
1171
1076
|
/**
|
|
1172
1077
|
* Generates a standard Azure Storage list blobs XML response body.
|
|
1173
1078
|
* @param containerName The container name.
|
|
@@ -1175,66 +1080,29 @@ export declare const getListBlobsSegmentResponse: (containerName: string, prefix
|
|
|
1175
1080
|
* @returns A formatted XML string.
|
|
1176
1081
|
*/
|
|
1177
1082
|
export declare const getListBlobsXml: (containerName: string, blobsXml: string) => string;
|
|
1178
|
-
//#endregion
|
|
1179
|
-
//#region src/services/container/getMockBlobKey.d.ts
|
|
1180
1083
|
export declare const getMockBlobKey: (containerName: string, blobName: string) => string;
|
|
1181
|
-
//#endregion
|
|
1182
|
-
//#region src/services/container/getMockContainer.d.ts
|
|
1183
1084
|
export declare const getMockContainer: (containerName: string) => MapValue<typeof MockContainerDatabase>;
|
|
1184
|
-
//#endregion
|
|
1185
|
-
//#region src/services/container/readMockBlobDates.d.ts
|
|
1186
1085
|
export declare const readMockBlobDates: (containerName: string, blobName: string) => MockBlobDates;
|
|
1187
|
-
//#endregion
|
|
1188
|
-
//#region src/services/container/readMockBlobMetadata.d.ts
|
|
1189
1086
|
export declare const readMockBlobMetadata: (containerName: string, blobName: string) => Record<string, string> | undefined;
|
|
1190
|
-
//#endregion
|
|
1191
|
-
//#region src/services/container/storeMockBlobMetadata.d.ts
|
|
1192
1087
|
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
1088
|
export declare const storeMockBlobWrite: (containerName: string, blobName: string, isExisting: boolean) => void;
|
|
1196
|
-
//#endregion
|
|
1197
|
-
//#region src/services/container/toWebResourceLike.d.ts
|
|
1198
1089
|
export declare const toWebResourceLike: (request: PipelineRequest) => WebResourceLike;
|
|
1199
|
-
//#endregion
|
|
1200
|
-
//#region src/services/filter/applyFilter.d.ts
|
|
1201
1090
|
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
1091
|
export declare const checkIsNullClause: (clause: Clause<Record<string, unknown>>) => boolean;
|
|
1205
|
-
//#endregion
|
|
1206
|
-
//#region src/services/filter/compare.d.ts
|
|
1207
1092
|
export declare const compare: <T>(operator: BinaryOperator, leftHandSide: T, rightHandSide: null | T) => boolean;
|
|
1208
|
-
//#endregion
|
|
1209
|
-
//#region src/services/filter/createFilterPredicate.d.ts
|
|
1210
1093
|
export declare const createFilterPredicate: (filter: string) => ((document: Record<string, unknown>) => boolean);
|
|
1211
|
-
//#endregion
|
|
1212
|
-
//#region src/services/queue/getMockQueueMessageItem.d.ts
|
|
1213
1094
|
export declare const getMockQueueMessageItem: (messageText: string) => {
|
|
1214
1095
|
expiresOn: Date;
|
|
1215
1096
|
insertedOn: Date;
|
|
1216
1097
|
messageId: string;
|
|
1217
1098
|
messageText: string;
|
|
1218
1099
|
};
|
|
1219
|
-
//#endregion
|
|
1220
|
-
//#region src/services/shared/createMockResponse.d.ts
|
|
1221
1100
|
export declare const createMockResponse: (status: number, url?: string) => MockResponse;
|
|
1222
|
-
//#endregion
|
|
1223
|
-
//#region src/services/shared/getMockSasUrl.d.ts
|
|
1224
1101
|
export declare const getMockSasUrl: (url: string, permissions: undefined | {
|
|
1225
1102
|
toString: () => string;
|
|
1226
1103
|
}, resourceType?: string) => string;
|
|
1227
|
-
//#endregion
|
|
1228
|
-
//#region src/services/table/compareByCompositeKey.d.ts
|
|
1229
1104
|
export declare const compareByCompositeKey: (firstEntity: TableEntity, secondEntity: TableEntity) => number;
|
|
1230
|
-
//#endregion
|
|
1231
|
-
//#region src/store/MockContainerBlobDatesDatabase.d.ts
|
|
1232
1105
|
export declare const MockContainerBlobDatesDatabase: Map<string, MockBlobDates>;
|
|
1233
|
-
//#endregion
|
|
1234
|
-
//#region src/store/MockContainerBlobMetadataDatabase.d.ts
|
|
1235
1106
|
export declare const MockContainerBlobMetadataDatabase: Map<string, Record<string, string>>;
|
|
1236
|
-
//#endregion
|
|
1237
|
-
//#region src/store/MockEventGridDatabase.d.ts
|
|
1238
1107
|
export declare const MockEventGridDatabase: Map<string, EventGridEvent<unknown>[]>;
|
|
1239
|
-
//#endregion
|
|
1240
1108
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { RestError, createHttpHeaders, createPipelineRequest } from "@azure/core
|
|
|
4
4
|
import { AnonymousCredential } from "@azure/storage-blob";
|
|
5
5
|
import { Readable } from "node:stream";
|
|
6
6
|
import { AZURE_MAX_PAGE_SIZE, AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS, BinaryOperator, deserializeClause, deserializeKey, getTableNullClause, serializeClauses } from "@esposter/azure";
|
|
7
|
-
|
|
7
|
+
// src/constants.ts
|
|
8
8
|
const BLOB_NOT_FOUND_ERROR_CODE = "BlobNotFound";
|
|
9
9
|
const BLOB_NOT_FOUND_MESSAGE = "The specified blob does not exist.";
|
|
10
10
|
const CONDITION_NOT_MET_ERROR_CODE = "ConditionNotMet";
|
|
@@ -13,25 +13,20 @@ const MOCK_BLOB_BASE_URL = "https://mockaccount.blob.core.windows.net";
|
|
|
13
13
|
const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
|
|
14
14
|
const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
|
|
15
15
|
const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
|
|
16
|
-
|
|
17
|
-
//#region src/models/shared/NotImplementedError.ts
|
|
16
|
+
// src/models/shared/NotImplementedError.ts
|
|
18
17
|
var NotImplementedError = class extends Error {
|
|
19
18
|
constructor(name) {
|
|
20
19
|
super(`${name} is not implemented in the mock`);
|
|
21
20
|
this.name = "NotImplementedError";
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
|
-
|
|
25
|
-
//#region src/services/container/getMockBlobKey.ts
|
|
23
|
+
// src/services/container/getMockBlobKey.ts
|
|
26
24
|
const getMockBlobKey = (containerName, blobName) => `${encodeURIComponent(containerName)}${ID_SEPARATOR}${encodeURIComponent(blobName)}`;
|
|
27
|
-
|
|
28
|
-
//#region src/store/MockContainerBlobDatesDatabase.ts
|
|
25
|
+
// src/store/MockContainerBlobDatesDatabase.ts
|
|
29
26
|
const MockContainerBlobDatesDatabase = /* @__PURE__ */ new Map();
|
|
30
|
-
|
|
31
|
-
//#region src/store/MockContainerBlobMetadataDatabase.ts
|
|
27
|
+
// src/store/MockContainerBlobMetadataDatabase.ts
|
|
32
28
|
const MockContainerBlobMetadataDatabase = /* @__PURE__ */ new Map();
|
|
33
|
-
|
|
34
|
-
//#region src/store/MockContainerDatabase.ts
|
|
29
|
+
// src/store/MockContainerDatabase.ts
|
|
35
30
|
var MockContainerDatabaseMap = class extends Map {
|
|
36
31
|
clear() {
|
|
37
32
|
super.clear();
|
|
@@ -40,26 +35,22 @@ var MockContainerDatabaseMap = class extends Map {
|
|
|
40
35
|
}
|
|
41
36
|
};
|
|
42
37
|
const MockContainerDatabase = new MockContainerDatabaseMap();
|
|
43
|
-
|
|
44
|
-
//#region src/services/container/getMockContainer.ts
|
|
38
|
+
// src/services/container/getMockContainer.ts
|
|
45
39
|
const getMockContainer = (containerName) => getOrCreate(MockContainerDatabase, containerName, () => /* @__PURE__ */ new Map());
|
|
46
|
-
|
|
47
|
-
//#region src/services/container/storeMockBlobMetadata.ts
|
|
40
|
+
// src/services/container/storeMockBlobMetadata.ts
|
|
48
41
|
const storeMockBlobMetadata = (containerName, blobName, metadata) => {
|
|
49
42
|
const key = getMockBlobKey(containerName, blobName);
|
|
50
43
|
if (metadata) MockContainerBlobMetadataDatabase.set(key, metadata);
|
|
51
44
|
else MockContainerBlobMetadataDatabase.delete(key);
|
|
52
45
|
};
|
|
53
|
-
|
|
54
|
-
//#region src/services/container/deleteMockBlob.ts
|
|
46
|
+
// src/services/container/deleteMockBlob.ts
|
|
55
47
|
const deleteMockBlob = (containerName, blobName) => {
|
|
56
48
|
if (!getMockContainer(containerName).delete(blobName)) return false;
|
|
57
49
|
MockContainerBlobDatesDatabase.delete(getMockBlobKey(containerName, blobName));
|
|
58
50
|
storeMockBlobMetadata(containerName, blobName, void 0);
|
|
59
51
|
return true;
|
|
60
52
|
};
|
|
61
|
-
|
|
62
|
-
//#region src/services/container/getAzureErrorXml.ts
|
|
53
|
+
// src/services/container/getAzureErrorXml.ts
|
|
63
54
|
/**
|
|
64
55
|
* Generates a standard Azure Storage error XML response body.
|
|
65
56
|
* @param errorCode The official Azure error code (e.g., "BlobNotFound").
|
|
@@ -71,8 +62,7 @@ const getAzureErrorXml = (errorCode, errorMessage) => html`<?xml version="1.0" e
|
|
|
71
62
|
<code>${errorCode}</code>
|
|
72
63
|
<Message>${errorMessage}</Message>
|
|
73
64
|
</Error>`;
|
|
74
|
-
|
|
75
|
-
//#region src/services/container/getBlobUrlParts.ts
|
|
65
|
+
// src/services/container/getBlobUrlParts.ts
|
|
76
66
|
const decodeSegment = (segment) => getDecodedUriComponent(segment, segment);
|
|
77
67
|
const getBlobUrlParts = (url) => {
|
|
78
68
|
const parsedUrl = getResult(() => new URL(url)).unwrapOr(void 0);
|
|
@@ -84,19 +74,16 @@ const getBlobUrlParts = (url) => {
|
|
|
84
74
|
containerName: decodeSegment(takeOne(pathSegments))
|
|
85
75
|
};
|
|
86
76
|
};
|
|
87
|
-
|
|
88
|
-
//#region src/services/container/constants.ts
|
|
77
|
+
// src/services/container/constants.ts
|
|
89
78
|
const MOCK_BLOB_SEEDED_DATE = /* @__PURE__ */ new Date(-864e13);
|
|
90
79
|
const MOCK_BLOB_SEEDED_PROPERTIES = {
|
|
91
80
|
createdOn: MOCK_BLOB_SEEDED_DATE,
|
|
92
81
|
etag: "\"seeded\"",
|
|
93
82
|
lastModified: MOCK_BLOB_SEEDED_DATE
|
|
94
83
|
};
|
|
95
|
-
|
|
96
|
-
//#region src/services/container/readMockBlobDates.ts
|
|
84
|
+
// src/services/container/readMockBlobDates.ts
|
|
97
85
|
const readMockBlobDates = (containerName, blobName) => MockContainerBlobDatesDatabase.get(getMockBlobKey(containerName, blobName)) ?? MOCK_BLOB_SEEDED_PROPERTIES;
|
|
98
|
-
|
|
99
|
-
//#region src/services/container/toWebResourceLike.ts
|
|
86
|
+
// src/services/container/toWebResourceLike.ts
|
|
100
87
|
const toWebResourceLike = (request) => ({
|
|
101
88
|
abortSignal: request.abortSignal,
|
|
102
89
|
agent: request.agent,
|
|
@@ -122,16 +109,14 @@ const toWebResourceLike = (request) => ({
|
|
|
122
109
|
validateRequestProperties: noop,
|
|
123
110
|
withCredentials: request.withCredentials
|
|
124
111
|
});
|
|
125
|
-
|
|
126
|
-
//#region src/services/shared/createMockResponse.ts
|
|
112
|
+
// src/services/shared/createMockResponse.ts
|
|
127
113
|
const createMockResponse = (status, url = "") => ({
|
|
128
114
|
headers: toHttpHeadersLike(createHttpHeaders()),
|
|
129
115
|
parsedHeaders: {},
|
|
130
116
|
request: toWebResourceLike(createPipelineRequest({ url })),
|
|
131
117
|
status
|
|
132
118
|
});
|
|
133
|
-
|
|
134
|
-
//#region src/models/container/MockBlobBatchClient.ts
|
|
119
|
+
// src/models/container/MockBlobBatchClient.ts
|
|
135
120
|
var MockBlobBatchClient = class {
|
|
136
121
|
url;
|
|
137
122
|
constructor(url) {
|
|
@@ -212,19 +197,16 @@ var MockBlobBatchClient = class {
|
|
|
212
197
|
};
|
|
213
198
|
}
|
|
214
199
|
};
|
|
215
|
-
|
|
216
|
-
//#region src/models/shared/MockRestError.ts
|
|
200
|
+
// src/models/shared/MockRestError.ts
|
|
217
201
|
var MockRestError = class extends RestError {
|
|
218
202
|
constructor(message, statusCode) {
|
|
219
203
|
super(message, { statusCode });
|
|
220
204
|
this.name = "MockRestError";
|
|
221
205
|
}
|
|
222
206
|
};
|
|
223
|
-
|
|
224
|
-
//#region src/services/container/getBlobUrl.ts
|
|
207
|
+
// src/services/container/getBlobUrl.ts
|
|
225
208
|
const getBlobUrl = (containerName, blobName) => `${MOCK_BLOB_BASE_URL}/${containerName}/${blobName.split("/").map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
226
|
-
|
|
227
|
-
//#region src/services/container/storeMockBlobWrite.ts
|
|
209
|
+
// src/services/container/storeMockBlobWrite.ts
|
|
228
210
|
const storeMockBlobWrite = (containerName, blobName, isExisting) => {
|
|
229
211
|
const key = getMockBlobKey(containerName, blobName);
|
|
230
212
|
const lastModified = /* @__PURE__ */ new Date();
|
|
@@ -234,11 +216,9 @@ const storeMockBlobWrite = (containerName, blobName, isExisting) => {
|
|
|
234
216
|
lastModified
|
|
235
217
|
});
|
|
236
218
|
};
|
|
237
|
-
|
|
238
|
-
//#region src/services/shared/getMockSasUrl.ts
|
|
219
|
+
// src/services/shared/getMockSasUrl.ts
|
|
239
220
|
const getMockSasUrl = (url, permissions, resourceType) => `${url}?sv=2025-11-05&${resourceType ? `sr=${resourceType}&` : ""}sig=mock-signature&st=1970-01-01T00:00:00Z&se=2099-12-31T23:59:59Z&sp=${permissions?.toString() ?? "r"}`;
|
|
240
|
-
|
|
241
|
-
//#region src/models/container/MockBlobClient.ts
|
|
221
|
+
// src/models/container/MockBlobClient.ts
|
|
242
222
|
var MockBlobClient = class {
|
|
243
223
|
connectionString;
|
|
244
224
|
containerName;
|
|
@@ -396,11 +376,9 @@ var MockBlobClient = class {
|
|
|
396
376
|
throw new NotImplementedError(this.withVersion.name);
|
|
397
377
|
}
|
|
398
378
|
};
|
|
399
|
-
|
|
400
|
-
//#region src/services/container/checkIsReadableStream.ts
|
|
379
|
+
// src/services/container/checkIsReadableStream.ts
|
|
401
380
|
const checkIsReadableStream = (value) => value instanceof Readable;
|
|
402
|
-
|
|
403
|
-
//#region src/services/container/bodyToBuffer.ts
|
|
381
|
+
// src/services/container/bodyToBuffer.ts
|
|
404
382
|
const bodyToBuffer = async (body) => {
|
|
405
383
|
if (body === null) return Buffer.alloc(0);
|
|
406
384
|
else if (typeof body === "string") return Buffer.from(body);
|
|
@@ -428,8 +406,7 @@ const bodyToBuffer = async (body) => {
|
|
|
428
406
|
return Buffer.alloc(0);
|
|
429
407
|
}
|
|
430
408
|
};
|
|
431
|
-
|
|
432
|
-
//#region src/models/container/MockBlockBlobClient.ts
|
|
409
|
+
// src/models/container/MockBlockBlobClient.ts
|
|
433
410
|
var MockBlockBlobClient = class extends MockBlobClient {
|
|
434
411
|
commitBlockList() {
|
|
435
412
|
throw new NotImplementedError(this.commitBlockList.name);
|
|
@@ -475,8 +452,7 @@ var MockBlockBlobClient = class extends MockBlobClient {
|
|
|
475
452
|
throw new NotImplementedError(this.uploadStream.name);
|
|
476
453
|
}
|
|
477
454
|
};
|
|
478
|
-
|
|
479
|
-
//#region src/services/container/getBlobItemXml.ts
|
|
455
|
+
// src/services/container/getBlobItemXml.ts
|
|
480
456
|
const getBlobItemXml = ({ name, properties }) => html`<Blob>
|
|
481
457
|
<Name>${name}</Name>
|
|
482
458
|
<Properties>
|
|
@@ -489,11 +465,9 @@ const getBlobItemXml = ({ name, properties }) => html`<Blob>
|
|
|
489
465
|
<LeaseState>available</LeaseState>
|
|
490
466
|
</Properties>
|
|
491
467
|
</Blob>`;
|
|
492
|
-
|
|
493
|
-
//#region src/services/container/getBlobPrefixXml.ts
|
|
468
|
+
// src/services/container/getBlobPrefixXml.ts
|
|
494
469
|
const getBlobPrefixXml = (name) => html`<BlobPrefix><Name>${name}</Name></BlobPrefix>`;
|
|
495
|
-
|
|
496
|
-
//#region src/services/container/getListBlobsXml.ts
|
|
470
|
+
// src/services/container/getListBlobsXml.ts
|
|
497
471
|
/**
|
|
498
472
|
* Generates a standard Azure Storage list blobs XML response body.
|
|
499
473
|
* @param containerName The container name.
|
|
@@ -505,8 +479,7 @@ const getListBlobsXml = (containerName, blobsXml) => html`<?xml version="1.0" en
|
|
|
505
479
|
<Blobs>${blobsXml}</Blobs>
|
|
506
480
|
<NextMarker />
|
|
507
481
|
</EnumerationResults>`;
|
|
508
|
-
|
|
509
|
-
//#region src/services/container/getListBlobsSegmentResponse.ts
|
|
482
|
+
// src/services/container/getListBlobsSegmentResponse.ts
|
|
510
483
|
const getListBlobsSegmentResponse = (containerName, prefix, segment, blobsXml) => {
|
|
511
484
|
const segmentResponse = {
|
|
512
485
|
containerName,
|
|
@@ -524,11 +497,9 @@ const getListBlobsSegmentResponse = (containerName, prefix, segment, blobsXml) =
|
|
|
524
497
|
...segmentResponse
|
|
525
498
|
};
|
|
526
499
|
};
|
|
527
|
-
|
|
528
|
-
//#region src/services/container/readMockBlobMetadata.ts
|
|
500
|
+
// src/services/container/readMockBlobMetadata.ts
|
|
529
501
|
const readMockBlobMetadata = (containerName, blobName) => MockContainerBlobMetadataDatabase.get(getMockBlobKey(containerName, blobName));
|
|
530
|
-
|
|
531
|
-
//#region src/models/container/MockContainerClient.ts
|
|
502
|
+
// src/models/container/MockContainerClient.ts
|
|
532
503
|
/**
|
|
533
504
|
* An in-memory mock of the Azure ContainerClient — no emulator and no network.
|
|
534
505
|
*
|
|
@@ -719,11 +690,9 @@ var MockContainerClient = class {
|
|
|
719
690
|
}
|
|
720
691
|
}
|
|
721
692
|
};
|
|
722
|
-
|
|
723
|
-
//#region src/store/MockEventGridDatabase.ts
|
|
693
|
+
// src/store/MockEventGridDatabase.ts
|
|
724
694
|
const MockEventGridDatabase = /* @__PURE__ */ new Map();
|
|
725
|
-
|
|
726
|
-
//#region src/models/eventGrid/MockEventGridPublisherClient.ts
|
|
695
|
+
// src/models/eventGrid/MockEventGridPublisherClient.ts
|
|
727
696
|
/**
|
|
728
697
|
* An in-memory mock of the Azure EventGridPublisherClient — no emulator and no network.
|
|
729
698
|
* `client` is excluded because it is a private member of the real class and cannot be satisfied structurally.
|
|
@@ -742,8 +711,7 @@ var MockEventGridPublisherClient = class {
|
|
|
742
711
|
return Promise.resolve();
|
|
743
712
|
}
|
|
744
713
|
};
|
|
745
|
-
|
|
746
|
-
//#region src/services/queue/getMockQueueMessageItem.ts
|
|
714
|
+
// src/services/queue/getMockQueueMessageItem.ts
|
|
747
715
|
const getMockQueueMessageItem = (messageText) => {
|
|
748
716
|
const insertedOn = /* @__PURE__ */ new Date();
|
|
749
717
|
return {
|
|
@@ -753,11 +721,9 @@ const getMockQueueMessageItem = (messageText) => {
|
|
|
753
721
|
messageText
|
|
754
722
|
};
|
|
755
723
|
};
|
|
756
|
-
|
|
757
|
-
//#region src/store/MockQueueDatabase.ts
|
|
724
|
+
// src/store/MockQueueDatabase.ts
|
|
758
725
|
const MockQueueDatabase = /* @__PURE__ */ new Map();
|
|
759
|
-
|
|
760
|
-
//#region src/models/queue/MockQueueClient.ts
|
|
726
|
+
// src/models/queue/MockQueueClient.ts
|
|
761
727
|
/**
|
|
762
728
|
* An in-memory mock of the Azure QueueClient — no emulator and no network.
|
|
763
729
|
*
|
|
@@ -885,14 +851,12 @@ var MockQueueClient = class {
|
|
|
885
851
|
throw new NotImplementedError(this.updateMessage.name);
|
|
886
852
|
}
|
|
887
853
|
};
|
|
888
|
-
|
|
889
|
-
//#region src/services/filter/checkIsNullClause.ts
|
|
854
|
+
// src/services/filter/checkIsNullClause.ts
|
|
890
855
|
const checkIsNullClause = (clause) => {
|
|
891
856
|
const tableNullClause = getTableNullClause(clause.key);
|
|
892
857
|
return checkIsDeepEqual(clause, tableNullClause);
|
|
893
858
|
};
|
|
894
|
-
|
|
895
|
-
//#region src/services/filter/compare.ts
|
|
859
|
+
// src/services/filter/compare.ts
|
|
896
860
|
const compare = (operator, leftHandSide, rightHandSide) => {
|
|
897
861
|
if (rightHandSide === null || rightHandSide === void 0) {
|
|
898
862
|
if (operator !== BinaryOperator.Eq) throw new InvalidOperationError(Operation.Read, compare.name, JSON.stringify({
|
|
@@ -912,8 +876,7 @@ const compare = (operator, leftHandSide, rightHandSide) => {
|
|
|
912
876
|
default: return exhaustiveGuard(operator);
|
|
913
877
|
}
|
|
914
878
|
};
|
|
915
|
-
|
|
916
|
-
//#region src/services/filter/createFilterPredicate.ts
|
|
879
|
+
// src/services/filter/createFilterPredicate.ts
|
|
917
880
|
const createFilterPredicate = (filter) => {
|
|
918
881
|
const orGroups = filter.replaceAll(String.raw`(`, " ").replaceAll(String.raw`)`, "").split(/\s+and\s+/iu).filter(Boolean).map((group) => group.split(/\s+or\s+/iu).filter(Boolean).map((clauseString) => {
|
|
919
882
|
const clause = deserializeClause(clauseString);
|
|
@@ -943,11 +906,9 @@ const createFilterPredicate = (filter) => {
|
|
|
943
906
|
return true;
|
|
944
907
|
};
|
|
945
908
|
};
|
|
946
|
-
|
|
947
|
-
//#region src/store/MockSearchDatabase.ts
|
|
909
|
+
// src/store/MockSearchDatabase.ts
|
|
948
910
|
const MockSearchDatabase = /* @__PURE__ */ new Map();
|
|
949
|
-
|
|
950
|
-
//#region src/models/search/MockSearchClient.ts
|
|
911
|
+
// src/models/search/MockSearchClient.ts
|
|
951
912
|
const toComparable = (value) => {
|
|
952
913
|
if (value instanceof Date) return value.getTime();
|
|
953
914
|
else if (typeof value === "number" || typeof value === "string") return value;
|
|
@@ -1056,11 +1017,9 @@ var MockSearchClient = class {
|
|
|
1056
1017
|
return Promise.resolve({ results: [] });
|
|
1057
1018
|
}
|
|
1058
1019
|
};
|
|
1059
|
-
|
|
1060
|
-
//#region src/store/MockServiceBusDatabase.ts
|
|
1020
|
+
// src/store/MockServiceBusDatabase.ts
|
|
1061
1021
|
const MockServiceBusDatabase = /* @__PURE__ */ new Map();
|
|
1062
|
-
|
|
1063
|
-
//#region src/models/serviceBus/MockServiceBusSender.ts
|
|
1022
|
+
// src/models/serviceBus/MockServiceBusSender.ts
|
|
1064
1023
|
/**
|
|
1065
1024
|
* An in-memory mock of the Azure ServiceBusSender — no emulator and no network.
|
|
1066
1025
|
*
|
|
@@ -1102,18 +1061,15 @@ var MockServiceBusSender = class {
|
|
|
1102
1061
|
return Promise.resolve();
|
|
1103
1062
|
}
|
|
1104
1063
|
};
|
|
1105
|
-
|
|
1106
|
-
//#region src/services/table/compareByCompositeKey.ts
|
|
1064
|
+
// src/services/table/compareByCompositeKey.ts
|
|
1107
1065
|
const compareByCompositeKey = (firstEntity, secondEntity) => {
|
|
1108
1066
|
if (firstEntity.partitionKey !== secondEntity.partitionKey) return firstEntity.partitionKey < secondEntity.partitionKey ? -1 : 1;
|
|
1109
1067
|
else if (firstEntity.rowKey === secondEntity.rowKey) return 0;
|
|
1110
1068
|
else return firstEntity.rowKey < secondEntity.rowKey ? -1 : 1;
|
|
1111
1069
|
};
|
|
1112
|
-
|
|
1113
|
-
//#region src/store/MockTableDatabase.ts
|
|
1070
|
+
// src/store/MockTableDatabase.ts
|
|
1114
1071
|
const MockTableDatabase = /* @__PURE__ */ new Map();
|
|
1115
|
-
|
|
1116
|
-
//#region src/models/table/MockTableClient.ts
|
|
1072
|
+
// src/models/table/MockTableClient.ts
|
|
1117
1073
|
/**
|
|
1118
1074
|
* An in-memory mock of the Azure TableClient — no emulator and no network.
|
|
1119
1075
|
*
|
|
@@ -1291,8 +1247,7 @@ var MockTableClient = class {
|
|
|
1291
1247
|
});
|
|
1292
1248
|
}
|
|
1293
1249
|
};
|
|
1294
|
-
|
|
1295
|
-
//#region src/models/webPubSub/MockWebPubSubServiceClient.ts
|
|
1250
|
+
// src/models/webPubSub/MockWebPubSubServiceClient.ts
|
|
1296
1251
|
/**
|
|
1297
1252
|
* A minimal mock of the Azure WebPubSubServiceClient for testing purposes.
|
|
1298
1253
|
* Only implements `group().sendToAll` — the only method used in azure-functions tests.
|
|
@@ -1302,11 +1257,9 @@ var MockWebPubSubServiceClient = class {
|
|
|
1302
1257
|
return { sendToAll: () => Promise.resolve() };
|
|
1303
1258
|
}
|
|
1304
1259
|
};
|
|
1305
|
-
|
|
1306
|
-
//#region src/services/filter/applyFilter.ts
|
|
1260
|
+
// src/services/filter/applyFilter.ts
|
|
1307
1261
|
const applyFilter = (documents, clauses) => {
|
|
1308
1262
|
const predicate = createFilterPredicate(serializeClauses(clauses));
|
|
1309
1263
|
return documents.filter((document) => predicate(document));
|
|
1310
1264
|
};
|
|
1311
|
-
//#endregion
|
|
1312
1265
|
export { BLOB_NOT_FOUND_ERROR_CODE, BLOB_NOT_FOUND_MESSAGE, CONDITION_NOT_MET_ERROR_CODE, CONDITION_NOT_MET_MESSAGE, MOCK_BLOB_BASE_URL, MOCK_BLOB_SEEDED_DATE, MOCK_BLOB_SEEDED_PROPERTIES, MOCK_QUEUE_BASE_URL, MOCK_SEARCH_BASE_URL, MOCK_TABLE_BASE_URL, MockBlobBatchClient, MockBlobClient, MockBlockBlobClient, MockContainerBlobDatesDatabase, MockContainerBlobMetadataDatabase, MockContainerClient, MockContainerDatabase, MockEventGridDatabase, MockEventGridPublisherClient, MockQueueClient, MockQueueDatabase, MockRestError, MockSearchClient, MockSearchDatabase, MockServiceBusDatabase, MockServiceBusSender, MockTableClient, MockTableDatabase, MockWebPubSubServiceClient, NotImplementedError, applyFilter, bodyToBuffer, checkIsNullClause, checkIsReadableStream, compare, compareByCompositeKey, createFilterPredicate, createMockResponse, deleteMockBlob, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, getBlobUrl, getBlobUrlParts, getListBlobsSegmentResponse, getListBlobsXml, getMockBlobKey, getMockContainer, getMockQueueMessageItem, getMockSasUrl, readMockBlobDates, readMockBlobMetadata, storeMockBlobMetadata, storeMockBlobWrite, toWebResourceLike };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-mock",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
4
4
|
"description": "A library that contains azure mock classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"azure",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"typecheck": "tsc"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@esposter/azure": "4.3.
|
|
55
|
-
"@esposter/shared": "4.3.
|
|
54
|
+
"@esposter/azure": "4.3.3",
|
|
55
|
+
"@esposter/shared": "4.3.3"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@esposter/configuration": "4.3.
|
|
58
|
+
"@esposter/configuration": "4.3.3",
|
|
59
59
|
"tsdown": "^0.23.1",
|
|
60
60
|
"type-fest": "^5.10.0"
|
|
61
61
|
},
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"inlinedDependencies": {
|
|
73
73
|
"type-fest": "5.10.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "955bbc130ad9b28877fd4ae8efc73a045141ce01"
|
|
76
76
|
}
|