azure-mock 2.37.2 → 2.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/dist/index.d.ts +168 -62
- package/dist/index.js +97 -67
- package/package.json +21 -10
package/dist/index.js
CHANGED
|
@@ -3,41 +3,25 @@ import { toHttpHeadersLike } from "@azure/core-http-compat";
|
|
|
3
3
|
import { ID_SEPARATOR, InvalidOperationError, Operation, chunk, exhaustiveGuard, getDecodedUriComponent, getOrCreate, getResult, html, noop, streamToText, takeOne } from "@esposter/shared";
|
|
4
4
|
import { AnonymousCredential } from "@azure/storage-blob";
|
|
5
5
|
import { Readable } from "node:stream";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
17
|
-
key = keys[i];
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
-
get: ((k) => from[k]).bind(null, key),
|
|
20
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return to;
|
|
24
|
-
};
|
|
25
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
26
|
-
value: mod,
|
|
27
|
-
enumerable: true
|
|
28
|
-
}) : target, mod));
|
|
6
|
+
import { AZURE_MAX_PAGE_SIZE, AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS, BinaryOperator, deserializeClause, deserializeKey, getTableNullClause, serializeClauses } from "@esposter/azure";
|
|
7
|
+
import deepEqual from "fast-deep-equal";
|
|
8
|
+
//#region src/constants.ts
|
|
29
9
|
const BLOB_NOT_FOUND_ERROR_CODE = "BlobNotFound";
|
|
30
10
|
const BLOB_NOT_FOUND_MESSAGE = "The specified blob does not exist.";
|
|
31
11
|
const MOCK_BLOB_BASE_URL = "https://mockaccount.blob.core.windows.net";
|
|
32
12
|
const MOCK_QUEUE_BASE_URL = "https://mockaccount.queue.core.windows.net";
|
|
33
13
|
const MOCK_SEARCH_BASE_URL = "https://mockaccount.search.windows.net";
|
|
34
14
|
const MOCK_TABLE_BASE_URL = "https://mockaccount.table.core.windows.net";
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/models/MockRestError.ts
|
|
35
17
|
var MockRestError = class extends RestError {
|
|
36
18
|
constructor(message, statusCode) {
|
|
37
19
|
super(message, { statusCode });
|
|
38
20
|
this.name = "MockRestError";
|
|
39
21
|
}
|
|
40
22
|
};
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/services/container/toWebResourceLike.ts
|
|
41
25
|
const toWebResourceLike = (request) => ({
|
|
42
26
|
abortSignal: request.abortSignal,
|
|
43
27
|
agent: request.agent,
|
|
@@ -63,16 +47,24 @@ const toWebResourceLike = (request) => ({
|
|
|
63
47
|
validateRequestProperties: noop,
|
|
64
48
|
withCredentials: request.withCredentials
|
|
65
49
|
});
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/services/createMockResponse.ts
|
|
66
52
|
const createMockResponse = (status, url = "") => ({
|
|
67
53
|
headers: toHttpHeadersLike(createHttpHeaders()),
|
|
68
54
|
parsedHeaders: {},
|
|
69
55
|
request: toWebResourceLike(createPipelineRequest({ url })),
|
|
70
56
|
status
|
|
71
57
|
});
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/services/getMockSasUrl.ts
|
|
72
60
|
const getMockSasUrl = (url, permissions, resourceType) => `${url}?sv=2025-11-05&${resourceType ? `sr=${resourceType}&` : ""}sig=mock-signature&st=1970-01-01T00:00:00Z&se=2099-12-31T23:59:59Z&sp=${permissions?.toString() ?? "r"}`;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/store/MockContainerCreatedOnDatabase.ts
|
|
73
63
|
const MockContainerCreatedOnDatabase = /* @__PURE__ */ new Map();
|
|
74
64
|
const MOCK_BLOB_SEEDED_CREATED_ON = /* @__PURE__ */ new Date(-864e13);
|
|
75
65
|
const getMockContainerCreatedOnKey = (containerName, blobName) => `${containerName}/${blobName}`;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/store/MockContainerDatabase.ts
|
|
76
68
|
var MockContainerDatabaseMap = class extends Map {
|
|
77
69
|
clear() {
|
|
78
70
|
super.clear();
|
|
@@ -80,11 +72,23 @@ var MockContainerDatabaseMap = class extends Map {
|
|
|
80
72
|
}
|
|
81
73
|
};
|
|
82
74
|
const MockContainerDatabase = new MockContainerDatabaseMap();
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/store/MockEventGridDatabase.ts
|
|
83
77
|
const MockEventGridDatabase = /* @__PURE__ */ new Map();
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/store/MockQueueDatabase.ts
|
|
84
80
|
const MockQueueDatabase = /* @__PURE__ */ new Map();
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/store/MockSearchDatabase.ts
|
|
85
83
|
const MockSearchDatabase = /* @__PURE__ */ new Map();
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/store/MockServiceBusDatabase.ts
|
|
86
86
|
const MockServiceBusDatabase = /* @__PURE__ */ new Map();
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/store/MockTableDatabase.ts
|
|
87
89
|
const MockTableDatabase = /* @__PURE__ */ new Map();
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/services/container/getAzureErrorXml.ts
|
|
88
92
|
/**
|
|
89
93
|
* Generates a standard Azure Storage error XML response body.
|
|
90
94
|
* @param errorCode The official Azure error code (e.g., "BlobNotFound").
|
|
@@ -96,6 +100,8 @@ const getAzureErrorXml = (errorCode, errorMessage) => html`<?xml version="1.0" e
|
|
|
96
100
|
<code>${errorCode}</code>
|
|
97
101
|
<Message>${errorMessage}</Message>
|
|
98
102
|
</Error>`;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/services/container/getBlobUrlParts.ts
|
|
99
105
|
const decodeSegment = (segment) => getDecodedUriComponent(segment, segment);
|
|
100
106
|
const getBlobUrlParts = (url) => {
|
|
101
107
|
const parsedUrl = getResult(() => new URL(url)).unwrapOr(void 0);
|
|
@@ -107,7 +113,11 @@ const getBlobUrlParts = (url) => {
|
|
|
107
113
|
containerName: decodeSegment(takeOne(pathSegments))
|
|
108
114
|
};
|
|
109
115
|
};
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/services/container/getMockContainer.ts
|
|
110
118
|
const getMockContainer = (containerName) => getOrCreate(MockContainerDatabase, containerName, () => /* @__PURE__ */ new Map());
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/models/container/MockBlobBatchClient.ts
|
|
111
121
|
var MockBlobBatchClient = class {
|
|
112
122
|
url;
|
|
113
123
|
constructor(url) {
|
|
@@ -180,7 +190,11 @@ var MockBlobBatchClient = class {
|
|
|
180
190
|
};
|
|
181
191
|
}
|
|
182
192
|
};
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/services/container/getBlobUrl.ts
|
|
183
195
|
const getBlobUrl = (containerName, blobName) => `${MOCK_BLOB_BASE_URL}/${containerName}/${blobName.split("/").map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/models/container/MockBlobClient.ts
|
|
184
198
|
var MockBlobClient = class {
|
|
185
199
|
connectionString;
|
|
186
200
|
containerName;
|
|
@@ -294,7 +308,13 @@ var MockBlobClient = class {
|
|
|
294
308
|
throw new Error("Method not implemented.");
|
|
295
309
|
}
|
|
296
310
|
getProperties() {
|
|
297
|
-
|
|
311
|
+
const blob = this.container.get(this.name);
|
|
312
|
+
if (!blob) throw new MockRestError(BLOB_NOT_FOUND_MESSAGE, 404);
|
|
313
|
+
return Promise.resolve({
|
|
314
|
+
_response: createMockResponse(200),
|
|
315
|
+
contentLength: blob.byteLength,
|
|
316
|
+
createdOn: MockContainerCreatedOnDatabase.get(getMockContainerCreatedOnKey(this.containerName, this.name))
|
|
317
|
+
});
|
|
298
318
|
}
|
|
299
319
|
getTags() {
|
|
300
320
|
throw new Error("Method not implemented.");
|
|
@@ -330,7 +350,11 @@ var MockBlobClient = class {
|
|
|
330
350
|
throw new Error("Method not implemented.");
|
|
331
351
|
}
|
|
332
352
|
};
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/services/container/isReadableStream.ts
|
|
333
355
|
const isReadableStream = (value) => value instanceof Readable;
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/services/container/bodyToBuffer.ts
|
|
334
358
|
const bodyToBuffer = async (body) => {
|
|
335
359
|
if (body === null) return Buffer.alloc(0);
|
|
336
360
|
else if (typeof body === "string") return Buffer.from(body);
|
|
@@ -358,6 +382,8 @@ const bodyToBuffer = async (body) => {
|
|
|
358
382
|
return Buffer.alloc(0);
|
|
359
383
|
}
|
|
360
384
|
};
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/models/container/MockBlockBlobClient.ts
|
|
361
387
|
var MockBlockBlobClient = class extends MockBlobClient {
|
|
362
388
|
commitBlockList() {
|
|
363
389
|
throw new Error("Method not implemented.");
|
|
@@ -397,6 +423,8 @@ var MockBlockBlobClient = class extends MockBlobClient {
|
|
|
397
423
|
throw new Error("Method not implemented.");
|
|
398
424
|
}
|
|
399
425
|
};
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/services/container/getBlobItemXml.ts
|
|
400
428
|
const getBlobItemXml = ({ name, properties }) => html`<Blob>
|
|
401
429
|
<Name>${name}</Name>
|
|
402
430
|
<Properties>
|
|
@@ -409,7 +437,11 @@ const getBlobItemXml = ({ name, properties }) => html`<Blob>
|
|
|
409
437
|
<LeaseState>available</LeaseState>
|
|
410
438
|
</Properties>
|
|
411
439
|
</Blob>`;
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/services/container/getBlobPrefixXml.ts
|
|
412
442
|
const getBlobPrefixXml = (name) => html`<BlobPrefix><Name>${name}</Name></BlobPrefix>`;
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/services/container/getListBlobsXml.ts
|
|
413
445
|
/**
|
|
414
446
|
* Generates a standard Azure Storage list blobs XML response body.
|
|
415
447
|
* @param containerName The container name.
|
|
@@ -421,6 +453,8 @@ const getListBlobsXml = (containerName, blobsXml) => html`<?xml version="1.0" en
|
|
|
421
453
|
<Blobs>${blobsXml}</Blobs>
|
|
422
454
|
<NextMarker />
|
|
423
455
|
</EnumerationResults>`;
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/services/container/getListBlobsSegmentResponse.ts
|
|
424
458
|
const getListBlobsSegmentResponse = (containerName, prefix, segment, blobsXml) => {
|
|
425
459
|
const segmentResponse = {
|
|
426
460
|
containerName,
|
|
@@ -438,9 +472,10 @@ const getListBlobsSegmentResponse = (containerName, prefix, segment, blobsXml) =
|
|
|
438
472
|
...segmentResponse
|
|
439
473
|
};
|
|
440
474
|
};
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/models/container/MockContainerClient.ts
|
|
441
477
|
/**
|
|
442
|
-
* An in-memory mock of the Azure ContainerClient.
|
|
443
|
-
* It uses a Map to simulate blob storage.
|
|
478
|
+
* An in-memory mock of the Azure ContainerClient — no emulator and no network.
|
|
444
479
|
*
|
|
445
480
|
* @example
|
|
446
481
|
* const mockContainerClient = new MockContainerClient("", "hello world");
|
|
@@ -629,9 +664,10 @@ var MockContainerClient = class {
|
|
|
629
664
|
}
|
|
630
665
|
}
|
|
631
666
|
};
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/models/eventGrid/MockEventGridPublisherClient.ts
|
|
632
669
|
/**
|
|
633
|
-
* An in-memory mock of the Azure EventGridPublisherClient.
|
|
634
|
-
* It uses a Map to simulate event grid storage and correctly implements the EventGridPublisherClient interface.
|
|
670
|
+
* An in-memory mock of the Azure EventGridPublisherClient — no emulator and no network.
|
|
635
671
|
* `client` is excluded because it is a private member of the real class and cannot be satisfied structurally.
|
|
636
672
|
*/
|
|
637
673
|
var MockEventGridPublisherClient = class {
|
|
@@ -648,18 +684,21 @@ var MockEventGridPublisherClient = class {
|
|
|
648
684
|
return Promise.resolve();
|
|
649
685
|
}
|
|
650
686
|
};
|
|
687
|
+
//#endregion
|
|
688
|
+
//#region src/services/queue/getMockQueueMessageItem.ts
|
|
651
689
|
const getMockQueueMessageItem = (messageText) => {
|
|
652
690
|
const insertedOn = /* @__PURE__ */ new Date();
|
|
653
691
|
return {
|
|
654
|
-
expiresOn: new Date(insertedOn.getTime() +
|
|
692
|
+
expiresOn: new Date(insertedOn.getTime() + AZURE_MAX_QUEUE_VISIBILITY_TIMEOUT_MS),
|
|
655
693
|
insertedOn,
|
|
656
694
|
messageId: crypto.randomUUID(),
|
|
657
695
|
messageText
|
|
658
696
|
};
|
|
659
697
|
};
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region src/models/queue/MockQueueClient.ts
|
|
660
700
|
/**
|
|
661
|
-
* An in-memory mock of the Azure QueueClient.
|
|
662
|
-
* It uses a Map to simulate queue storage and correctly implements the QueueClient interface.
|
|
701
|
+
* An in-memory mock of the Azure QueueClient — no emulator and no network.
|
|
663
702
|
*
|
|
664
703
|
* @example
|
|
665
704
|
* const mockQueueClient = new MockQueueClient("", "hello world");
|
|
@@ -739,7 +778,9 @@ var MockQueueClient = class {
|
|
|
739
778
|
});
|
|
740
779
|
}
|
|
741
780
|
receiveMessages(_options) {
|
|
742
|
-
const
|
|
781
|
+
const queuedTexts = this.queue;
|
|
782
|
+
MockQueueDatabase.set(this.name, []);
|
|
783
|
+
const receivedMessageItems = queuedTexts.map((text) => Object.assign(getMockQueueMessageItem(text), {
|
|
743
784
|
dequeueCount: 1,
|
|
744
785
|
nextVisibleOn: /* @__PURE__ */ new Date(),
|
|
745
786
|
popReceipt: crypto.randomUUID()
|
|
@@ -788,6 +829,8 @@ var MockQueueClient = class {
|
|
|
788
829
|
throw new Error("Method not implemented.");
|
|
789
830
|
}
|
|
790
831
|
};
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region src/services/filter/compare.ts
|
|
791
834
|
const compare = (operator, leftHandSide, rightHandSide) => {
|
|
792
835
|
if (rightHandSide === null || rightHandSide === void 0) {
|
|
793
836
|
if (operator !== BinaryOperator.eq) throw new InvalidOperationError(Operation.Read, compare.name, JSON.stringify({
|
|
@@ -807,38 +850,14 @@ const compare = (operator, leftHandSide, rightHandSide) => {
|
|
|
807
850
|
default: return exhaustiveGuard(operator);
|
|
808
851
|
}
|
|
809
852
|
};
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
if (a === b) return true;
|
|
813
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
814
|
-
if (a.constructor !== b.constructor) return false;
|
|
815
|
-
var length, i, keys;
|
|
816
|
-
if (Array.isArray(a)) {
|
|
817
|
-
length = a.length;
|
|
818
|
-
if (length != b.length) return false;
|
|
819
|
-
for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
|
|
820
|
-
return true;
|
|
821
|
-
}
|
|
822
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
823
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
824
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
825
|
-
keys = Object.keys(a);
|
|
826
|
-
length = keys.length;
|
|
827
|
-
if (length !== Object.keys(b).length) return false;
|
|
828
|
-
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
829
|
-
for (i = length; i-- !== 0;) {
|
|
830
|
-
var key = keys[i];
|
|
831
|
-
if (!equal(a[key], b[key])) return false;
|
|
832
|
-
}
|
|
833
|
-
return true;
|
|
834
|
-
}
|
|
835
|
-
return a !== a && b !== b;
|
|
836
|
-
};
|
|
837
|
-
})))(), 1);
|
|
853
|
+
//#endregion
|
|
854
|
+
//#region src/services/filter/isNullClause.ts
|
|
838
855
|
const isNullClause = (clause) => {
|
|
839
856
|
const tableNullClause = getTableNullClause(clause.key);
|
|
840
|
-
return (
|
|
857
|
+
return deepEqual(clause, tableNullClause);
|
|
841
858
|
};
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region src/services/filter/createFilterPredicate.ts
|
|
842
861
|
const createFilterPredicate = (filter) => {
|
|
843
862
|
const orGroups = filter.replaceAll(String.raw`(`, " ").replaceAll(String.raw`)`, "").split(/\s+and\s+/iu).filter(Boolean).map((group) => group.split(/\s+or\s+/iu).filter(Boolean).map((clauseString) => {
|
|
844
863
|
const clause = deserializeClause(clauseString);
|
|
@@ -868,6 +887,8 @@ const createFilterPredicate = (filter) => {
|
|
|
868
887
|
return true;
|
|
869
888
|
};
|
|
870
889
|
};
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region src/models/search/MockSearchClient.ts
|
|
871
892
|
const toComparable = (value) => {
|
|
872
893
|
if (value instanceof Date) return value.getTime();
|
|
873
894
|
else if (typeof value === "number" || typeof value === "string") return value;
|
|
@@ -909,8 +930,8 @@ const searchDocuments = (documents, searchText, searchFields) => {
|
|
|
909
930
|
return documents.filter((document) => (searchFieldPaths ?? Object.keys(document).map((field) => field.split("/"))).some((pathSegments) => getSearchFieldValues(document, pathSegments).some((value) => typeof value === "string" && value.toLocaleLowerCase().includes(normalizedSearchText))));
|
|
910
931
|
};
|
|
911
932
|
/**
|
|
912
|
-
* An in-memory mock of the Azure SearchClient.
|
|
913
|
-
*
|
|
933
|
+
* An in-memory mock of the Azure SearchClient — no emulator and no network. It applies the same OData filtering
|
|
934
|
+
* as the other mock clients, so a query behaves the same here as it does against the service.
|
|
914
935
|
*
|
|
915
936
|
* @example
|
|
916
937
|
* const mockSearchClient = new MockSearchClient(SearchIndex.Messages);
|
|
@@ -975,9 +996,10 @@ var MockSearchClient = class {
|
|
|
975
996
|
return Promise.resolve({ results: [] });
|
|
976
997
|
}
|
|
977
998
|
};
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region src/models/serviceBus/MockServiceBusSender.ts
|
|
978
1001
|
/**
|
|
979
|
-
* An in-memory mock of the Azure ServiceBusSender.
|
|
980
|
-
* It uses a Map to simulate a Service Bus queue and correctly implements the ServiceBusSender interface.
|
|
1002
|
+
* An in-memory mock of the Azure ServiceBusSender — no emulator and no network.
|
|
981
1003
|
*
|
|
982
1004
|
* @example
|
|
983
1005
|
* const mockServiceBusSender = new MockServiceBusSender("hello world");
|
|
@@ -1017,14 +1039,17 @@ var MockServiceBusSender = class {
|
|
|
1017
1039
|
return Promise.resolve();
|
|
1018
1040
|
}
|
|
1019
1041
|
};
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/services/table/compareByCompositeKey.ts
|
|
1020
1044
|
const compareByCompositeKey = (a, b) => {
|
|
1021
1045
|
if (a.partitionKey !== b.partitionKey) return a.partitionKey < b.partitionKey ? -1 : 1;
|
|
1022
1046
|
else if (a.rowKey === b.rowKey) return 0;
|
|
1023
1047
|
else return a.rowKey < b.rowKey ? -1 : 1;
|
|
1024
1048
|
};
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region src/models/table/MockTableClient.ts
|
|
1025
1051
|
/**
|
|
1026
|
-
* An in-memory mock of the Azure TableClient.
|
|
1027
|
-
* It uses a Map to simulate table storage and correctly implements the TableClient interface.
|
|
1052
|
+
* An in-memory mock of the Azure TableClient — no emulator and no network.
|
|
1028
1053
|
*
|
|
1029
1054
|
* @example
|
|
1030
1055
|
* const mockTableClient = new MockTableClient("", "hello world");
|
|
@@ -1200,6 +1225,8 @@ var MockTableClient = class {
|
|
|
1200
1225
|
};
|
|
1201
1226
|
}
|
|
1202
1227
|
};
|
|
1228
|
+
//#endregion
|
|
1229
|
+
//#region src/models/webPubSub/MockWebPubSubServiceClient.ts
|
|
1203
1230
|
/**
|
|
1204
1231
|
* A minimal mock of the Azure WebPubSubServiceClient for testing purposes.
|
|
1205
1232
|
* Only implements `group().sendToAll` — the only method used in azure-functions tests.
|
|
@@ -1209,8 +1236,11 @@ var MockWebPubSubServiceClient = class {
|
|
|
1209
1236
|
return { sendToAll: () => Promise.resolve() };
|
|
1210
1237
|
}
|
|
1211
1238
|
};
|
|
1239
|
+
//#endregion
|
|
1240
|
+
//#region src/services/filter/applyFilter.ts
|
|
1212
1241
|
const applyFilter = (documents, clauses) => {
|
|
1213
1242
|
const predicate = createFilterPredicate(serializeClauses(clauses));
|
|
1214
1243
|
return documents.filter((document) => predicate(document));
|
|
1215
1244
|
};
|
|
1245
|
+
//#endregion
|
|
1216
1246
|
export { BLOB_NOT_FOUND_ERROR_CODE, BLOB_NOT_FOUND_MESSAGE, MOCK_BLOB_BASE_URL, MOCK_BLOB_SEEDED_CREATED_ON, MOCK_QUEUE_BASE_URL, MOCK_SEARCH_BASE_URL, MOCK_TABLE_BASE_URL, MockBlobBatchClient, MockBlobClient, MockBlockBlobClient, MockContainerClient, MockContainerCreatedOnDatabase, MockContainerDatabase, MockEventGridDatabase, MockEventGridPublisherClient, MockQueueClient, MockQueueDatabase, MockRestError, MockSearchClient, MockSearchDatabase, MockServiceBusDatabase, MockServiceBusSender, MockTableClient, MockTableDatabase, MockWebPubSubServiceClient, applyFilter, bodyToBuffer, compare, compareByCompositeKey, createFilterPredicate, createMockResponse, getAzureErrorXml, getBlobItemXml, getBlobPrefixXml, getBlobUrl, getBlobUrlParts, getListBlobsSegmentResponse, getListBlobsXml, getMockContainer, getMockContainerCreatedOnKey, getMockQueueMessageItem, getMockSasUrl, isNullClause, isReadableStream, toWebResourceLike };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-mock",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.38.1",
|
|
4
4
|
"description": "A library that contains azure mock classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"azure",
|
|
@@ -31,13 +31,20 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"type": "module",
|
|
34
|
-
"
|
|
34
|
+
"sideEffects": false,
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
|
+
"imports": {
|
|
37
|
+
"#src/*": "./src/*.ts"
|
|
38
|
+
},
|
|
39
|
+
"exports": {
|
|
40
|
+
".": "./dist/index.js",
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
36
43
|
"publishConfig": {
|
|
37
44
|
"access": "public"
|
|
38
45
|
},
|
|
39
46
|
"scripts": {
|
|
40
|
-
"build": "pnpm export:gen &&
|
|
47
|
+
"build": "pnpm export:gen && tsdown",
|
|
41
48
|
"export:gen": "ctix build --config ../configuration/.ctirc-ts",
|
|
42
49
|
"format": "oxfmt",
|
|
43
50
|
"format:check": "oxfmt --check",
|
|
@@ -47,18 +54,19 @@
|
|
|
47
54
|
"typecheck": "tsgo"
|
|
48
55
|
},
|
|
49
56
|
"dependencies": {
|
|
50
|
-
"@esposter/
|
|
51
|
-
"@esposter/
|
|
52
|
-
"@esposter/shared": "2.37.2",
|
|
57
|
+
"@esposter/azure": "2.38.1",
|
|
58
|
+
"@esposter/shared": "2.38.1",
|
|
53
59
|
"fast-deep-equal": "^3.1.3"
|
|
54
60
|
},
|
|
55
61
|
"devDependencies": {
|
|
56
|
-
"@
|
|
62
|
+
"@arethetypeswrong/core": "^0.18.5",
|
|
63
|
+
"@esposter/configuration": "2.38.1",
|
|
57
64
|
"ctix": "^2.8.2",
|
|
58
|
-
"
|
|
65
|
+
"publint": "^0.3.24",
|
|
66
|
+
"tsdown": "^0.22.14",
|
|
59
67
|
"type-fest": "^5.8.0",
|
|
60
68
|
"typedoc": "^0.28.20",
|
|
61
|
-
"vitest": "^4.1.
|
|
69
|
+
"vitest": "^4.1.11"
|
|
62
70
|
},
|
|
63
71
|
"peerDependencies": {
|
|
64
72
|
"@azure/core-http-compat": "^2.5.0",
|
|
@@ -70,5 +78,8 @@
|
|
|
70
78
|
"@azure/storage-blob": "^12.33.0",
|
|
71
79
|
"@azure/storage-queue": "^12.31.0"
|
|
72
80
|
},
|
|
73
|
-
"
|
|
81
|
+
"inlinedDependencies": {
|
|
82
|
+
"type-fest": "5.8.0"
|
|
83
|
+
},
|
|
84
|
+
"gitHead": "b4c56347a01ac26a5e447c934a0c3c3308161bb5"
|
|
74
85
|
}
|