@getaster/mock 0.3.0 → 0.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 +41 -4
- package/package.json +2 -2
- package/wasm/ARTIFACT.json +2 -2
- package/wasm/odata_mock.wasm +0 -0
package/README.md
CHANGED
|
@@ -20,6 +20,41 @@ or install script is required. It provides ES modules and TypeScript declaration
|
|
|
20
20
|
Node.js use requires Node 22 or later. Browser builds must serve the WASM asset
|
|
21
21
|
over HTTP or pass its bytes explicitly.
|
|
22
22
|
|
|
23
|
+
### The WASM location and browser route
|
|
24
|
+
|
|
25
|
+
The engine is `wasm/odata_mock.wasm` inside the installed package. The package
|
|
26
|
+
exports the file, so `import.meta.resolve('@getaster/mock/wasm/odata_mock.wasm')`
|
|
27
|
+
returns its location in Node.js and Bun.
|
|
28
|
+
|
|
29
|
+
A browser page typically passes a URL and lets the development server serve it.
|
|
30
|
+
The documented convention is the root-relative route:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
const mock = await createMockService({
|
|
34
|
+
metadata, data,
|
|
35
|
+
wasm: new URL('odata_mock.wasm', document.baseURI),
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The server must serve the installed file at `/odata_mock.wasm`:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import { fileURLToPath } from 'node:url';
|
|
43
|
+
const wasm = Bun.file(fileURLToPath(import.meta.resolve('@getaster/mock/wasm/odata_mock.wasm')));
|
|
44
|
+
|
|
45
|
+
Bun.serve({
|
|
46
|
+
port: 4200,
|
|
47
|
+
routes: {
|
|
48
|
+
'/odata_mock.wasm': () => new Response(wasm, { headers: { 'content-type': 'application/wasm' } }),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`apps/showcase/serve.ts` implements this route for the repository's demo, and
|
|
54
|
+
`scripts/verify-wasm.ts` checks the binary's checksum, module and attribution
|
|
55
|
+
files before distribution. Pass `wasm` bytes, a `URL` or a URL string instead
|
|
56
|
+
when the file lives elsewhere; its default is the package-relative file.
|
|
57
|
+
|
|
23
58
|
## Run a local service in Node.js
|
|
24
59
|
|
|
25
60
|
TypeScript projects using this Node.js example also need `@types/node` as a
|
|
@@ -84,7 +119,9 @@ behaviour. Optional storage supports persistence; `dump()`, `flush()` and
|
|
|
84
119
|
|
|
85
120
|
## License
|
|
86
121
|
|
|
87
|
-
Aster UI
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
122
|
+
Aster UI is licensed under Apache-2.0; see `LICENSE` and `NOTICE`. The optional
|
|
123
|
+
mock engine is supplied as an Apache-2.0-licensed WebAssembly binary; its
|
|
124
|
+
implementation source is not included. Bundled third-party components retain
|
|
125
|
+
their respective licenses. Their attribution inventory is in `wasm/NOTICE`, with
|
|
126
|
+
license texts in `wasm/licenses/`. Preserve these files when redistributing the
|
|
127
|
+
binary.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getaster/mock",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"./wasm/odata_mock.wasm": "./wasm/odata_mock.wasm"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@getaster/data": "0.
|
|
14
|
+
"@getaster/data": "0.4.0"
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
17
|
"repository": {
|
package/wasm/ARTIFACT.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"license": "Apache-2.0",
|
|
3
|
-
"sha256": "
|
|
4
|
-
"bytes":
|
|
3
|
+
"sha256": "59e71c28418c00925afc3d896fc5bfdf7a3bdc17ab49b311135a06f8237fe027",
|
|
4
|
+
"bytes": 5179274,
|
|
5
5
|
"compiler": "rustc 1.96.0 (ac68faa20 2026-05-25)",
|
|
6
6
|
"format": "wasm32-wasip1",
|
|
7
7
|
"dependencies": [
|
package/wasm/odata_mock.wasm
CHANGED
|
Binary file
|