azure-mock 4.3.1 → 4.4.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.
- package/README.md +19 -32
- package/package.json +7 -7
- package/dist/index.d.ts +0 -1240
- package/dist/index.js +0 -1312
package/README.md
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
6
|
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
7
|
|
|
8
|
-
Mock Azure service classes for local development and testing
|
|
8
|
+
Mock Azure service classes for local development and testing, providing in-memory implementations of Azure Table Storage, Blob Storage, Service Bus, and EventGrid clients that mirror the real Azure SDK interfaces.
|
|
9
|
+
|
|
10
|
+
Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/openspec/specs).
|
|
9
11
|
|
|
10
12
|
## Table of Contents
|
|
11
13
|
|
|
12
14
|
- 🚀 [Getting Started](#getting-started)
|
|
13
|
-
-
|
|
15
|
+
- 🧩 [Key Exports](#key-exports)
|
|
14
16
|
- ⚖️ [License](#license)
|
|
15
17
|
|
|
16
18
|
---
|
|
@@ -18,30 +20,9 @@ Mock Azure service classes for local development and testing. Provides in-memory
|
|
|
18
20
|
## <a name="getting-started">🚀 Getting Started</a>
|
|
19
21
|
|
|
20
22
|
```bash
|
|
21
|
-
pnpm i -D azure-mock @azure/core-http-compat @azure/core-rest-pipeline @azure/data-tables @azure/eventgrid @azure/service-bus @azure/storage-blob
|
|
23
|
+
pnpm i -D azure-mock @azure/core-http-compat @azure/core-rest-pipeline @azure/data-tables @azure/eventgrid @azure/search-documents @azure/service-bus @azure/storage-blob @azure/storage-queue
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
## <a name="documentation">📖 Documentation</a>
|
|
25
|
-
|
|
26
|
-
We highly recommend you take a look at the [documentation](https://github.com/Esposter/Esposter/tree/main/openspec/specs) to level up.
|
|
27
|
-
|
|
28
|
-
### Available Mocks
|
|
29
|
-
|
|
30
|
-
| Class | Azure Equivalent | Description |
|
|
31
|
-
| ------------------------------ | -------------------------- | -------------------------------------------- |
|
|
32
|
-
| `MockTableClient` | `TableClient` | In-memory Azure Table Storage |
|
|
33
|
-
| `MockContainerClient` | `ContainerClient` | In-memory blob container, listing and paging |
|
|
34
|
-
| `MockBlobClient` | `BlobClient` | In-memory blob read, copy and delete |
|
|
35
|
-
| `MockBlockBlobClient` | `BlockBlobClient` | In-memory block blob upload and download |
|
|
36
|
-
| `MockBlobBatchClient` | `BlobBatchClient` | In-memory batched blob deletion |
|
|
37
|
-
| `MockSearchClient` | `SearchClient` | In-memory Azure AI Search index |
|
|
38
|
-
| `MockQueueClient` | `QueueClient` | In-memory Azure Storage Queue |
|
|
39
|
-
| `MockServiceBusSender` | `ServiceBusSender` | In-memory Azure Service Bus |
|
|
40
|
-
| `MockWebPubSubServiceClient` | `WebPubSubServiceClient` | In-memory Azure Web PubSub |
|
|
41
|
-
| `MockEventGridPublisherClient` | `EventGridPublisherClient` | In-memory EventGrid publisher |
|
|
42
|
-
|
|
43
|
-
Each client's state lives in an exported `Mock*Database` map (`MockTableDatabase`, `MockContainerDatabase`, …), so a test resets by clearing the one it seeded.
|
|
44
|
-
|
|
45
26
|
### Usage
|
|
46
27
|
|
|
47
28
|
```ts
|
|
@@ -55,16 +36,22 @@ const entity = await mockTableClient.getEntity("pk", "rk");
|
|
|
55
36
|
|
|
56
37
|
Replace real Azure clients with their mock equivalents by swapping them in your test setup or local `.env` configuration.
|
|
57
38
|
|
|
58
|
-
|
|
39
|
+
## <a name="key-exports">🧩 Key Exports</a>
|
|
59
40
|
|
|
60
|
-
|
|
41
|
+
| Class | Azure Equivalent | Description |
|
|
42
|
+
| ------------------------------ | -------------------------- | -------------------------------------------- |
|
|
43
|
+
| `MockBlobBatchClient` | `BlobBatchClient` | In-memory batched blob deletion |
|
|
44
|
+
| `MockBlobClient` | `BlobClient` | In-memory blob read, copy and delete |
|
|
45
|
+
| `MockBlockBlobClient` | `BlockBlobClient` | In-memory block blob upload and download |
|
|
46
|
+
| `MockContainerClient` | `ContainerClient` | In-memory blob container, listing and paging |
|
|
47
|
+
| `MockEventGridPublisherClient` | `EventGridPublisherClient` | In-memory EventGrid publisher |
|
|
48
|
+
| `MockQueueClient` | `QueueClient` | In-memory Azure Storage Queue |
|
|
49
|
+
| `MockSearchClient` | `SearchClient` | In-memory Azure AI Search index |
|
|
50
|
+
| `MockServiceBusSender` | `ServiceBusSender` | In-memory Azure Service Bus |
|
|
51
|
+
| `MockTableClient` | `TableClient` | In-memory Azure Table Storage |
|
|
52
|
+
| `MockWebPubSubServiceClient` | `WebPubSubServiceClient` | Stub: `group().sendToAll` and nothing else |
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
pnpm build # compile to dist/
|
|
64
|
-
pnpm test # vitest watch mode (coverage is run from the repo root)
|
|
65
|
-
pnpm lint:fix # auto-fix lint
|
|
66
|
-
pnpm typecheck # type check
|
|
67
|
-
```
|
|
54
|
+
Each client's state lives in an exported `Mock*Database` map (`MockTableDatabase`, `MockContainerDatabase`, …), so a test resets by clearing the one it seeded.
|
|
68
55
|
|
|
69
56
|
## <a name="license">⚖️ License</a>
|
|
70
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-mock",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "A library that contains azure mock classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"azure",
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
"lint": "eslint .",
|
|
49
49
|
"lint:fix": "eslint --fix .",
|
|
50
50
|
"test": "vitest",
|
|
51
|
-
"typecheck": "
|
|
51
|
+
"typecheck": "tsrs --fast"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@esposter/azure": "4.
|
|
55
|
-
"@esposter/shared": "4.
|
|
54
|
+
"@esposter/azure": "4.4.0",
|
|
55
|
+
"@esposter/shared": "4.4.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@esposter/configuration": "4.
|
|
59
|
-
"tsdown": "
|
|
58
|
+
"@esposter/configuration": "4.4.0",
|
|
59
|
+
"tsdown": "0.23.2",
|
|
60
60
|
"type-fest": "^5.10.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"inlinedDependencies": {
|
|
73
73
|
"type-fest": "5.10.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "e1a416c4b91da69cc2aa259b50a4d656f204d272"
|
|
76
76
|
}
|