@ms-cloudpack/data-bus 0.5.0 → 0.5.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/README.md +7 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @ms-cloudpack/data-bus
|
|
2
2
|
|
|
3
|
-
Provides a general
|
|
3
|
+
Provides a general API for subscribing/unsubscribing from data and defining providers to that data.
|
|
4
4
|
|
|
5
5
|
Examples of usage:
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ Examples of usage:
|
|
|
11
11
|
|
|
12
12
|
### Initialization
|
|
13
13
|
|
|
14
|
-
A data bus can be created using the `createDataBus`
|
|
14
|
+
A data bus can be created using the `createDataBus` API:
|
|
15
15
|
|
|
16
16
|
```js
|
|
17
17
|
import { createDataBus } from '@ms-cloudpack/data-bus';
|
|
@@ -106,19 +106,19 @@ const currentValue = bus.getData(itemCountPath);
|
|
|
106
106
|
|
|
107
107
|
## Motivation
|
|
108
108
|
|
|
109
|
-
Cloudpack runs a bundle
|
|
109
|
+
Cloudpack runs a bundle server which is accessed to generate and retrieve ESM package bundles on the fly. As dependencies are requested, the server produces assets into a cache folder.
|
|
110
110
|
|
|
111
111
|
Many consumers may request the same bundle at the same time. This implies 1. We need to dedupe redundant requests, and 2. We need to reuse the output to fulfill future requests.
|
|
112
112
|
|
|
113
|
-
In the original implementation, requests to the same resource would first check cache for results, find it missing, and start bundling by calling an imperative
|
|
113
|
+
In the original implementation, requests to the same resource would first check cache for results, find it missing, and start bundling by calling an imperative API like `async bundle(options: Options): Result`. This would write to a cache location, which would then fulfill future requests. But this left race conditions because we weren't deduping in-flight requests, nor were we re-populating bundles that changed inputs slightly. This led to the question: what kind of architecture would we need to essentially dedupe redundant requests, and provide a general architecture for caching content?
|
|
114
114
|
|
|
115
115
|
We ran into other similar scenarios:
|
|
116
116
|
|
|
117
|
-
-
|
|
118
|
-
-
|
|
117
|
+
- One or more dashboard pages need a list of packages installed. When the dependencies change, the page should be notified so that it can update UI.
|
|
118
|
+
- One or more dashboard instances needs metadata for a package. Metadata access is expensive, so we should dedupe requests and ensure the results go to all subscribers.
|
|
119
119
|
- Dashboards need to show the current build state for a session. Green for pass, red for fail, and should render errors when clicked. This also requires live updates, and may have multiple subscribers.
|
|
120
120
|
|
|
121
|
-
This led to the idea of a data
|
|
121
|
+
This led to the idea of a data bus: a general mediator for managing subscriptions and informing providers when results are available or have changed.
|
|
122
122
|
|
|
123
123
|
## Future considerations
|
|
124
124
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/data-bus",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A data bus implementation.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test": "cloudpack-scripts test"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"zod": "^
|
|
27
|
+
"zod": "^4.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|