Skip to content

Commit 597dfc8

Browse files
committed
fix biome lint and clarify w3ds documentation examples
1 parent 192c8ef commit 597dfc8

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

infrastructure/web3-adapter/MAPPING_RULES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,15 @@ Uploads inline file payloads to the owner eVault's object storage and replaces
9494
them with a stable `w3ds://file` URI. On the way back, the URI is dereferenced
9595
to the file's public URL.
9696

97+
Same global field name as the local field:
98+
9799
```json
98100
"avatar": "__file(avatar)"
101+
```
102+
103+
Different global field name (via a `,alias` suffix):
104+
105+
```json
99106
"avatar": "__file(avatar),avatarUri"
100107
```
101108

infrastructure/web3-adapter/W3DS_URI.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ files within the MetaState ecosystem.
55

66
## Format
77

8-
```
8+
```text
99
w3ds://file?id=@<user-ename>/<meta-envelope-id>
1010
```
1111

@@ -19,7 +19,7 @@ w3ds://file?id=@<user-ename>/<meta-envelope-id>
1919

2020
Example:
2121

22-
```
22+
```text
2323
w3ds://file?id=@alice/envelope-abc123
2424
```
2525

@@ -52,7 +52,7 @@ There are two dereferencers:
5252

5353
### HTTP — eVault core
5454

55-
```
55+
```http
5656
GET /files/:metaEnvelopeId (header: X-ENAME: @<user-ename>)
5757
```
5858

infrastructure/web3-adapter/src/mapper/file-directive.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { describe, expect, it, vi } from "vitest";
2-
import type { EVaultClient } from "../evault/evault";
32
import type { MappingDatabase } from "../db";
4-
import type { IMapping } from "./mapper.types";
3+
import type { EVaultClient } from "../evault/evault";
54
import { fromGlobal, toGlobal } from "./mapper";
5+
import type { IMapping } from "./mapper.types";
66

77
// Minimal stubs — the `__file()` directive paths never touch the mapping store.
88
const mappingStore = {} as MappingDatabase;
@@ -15,8 +15,7 @@ function mockClient(): EVaultClient {
1515
uploadFile: vi.fn(async (_w3id: string, input: { filename: string }) => ({
1616
uri: "w3ds://file?id=@owner/env-123",
1717
metaEnvelopeId: "env-123",
18-
publicUrl:
19-
"https://cdn.example.com/files/owner/env-123-" + input.filename,
18+
publicUrl: `https://cdn.example.com/files/owner/env-123-${input.filename}`,
2019
})),
2120
fetchMetaEnvelope: vi.fn(async (id: string) => ({
2221
id,

infrastructure/web3-adapter/src/w3ds/resolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* file's public object-storage URL plus its descriptive metadata.
77
*/
88
import type { EVaultClient, UploadFileInput } from "../evault/evault";
9-
import { parseFileUri, W3DS_FILE_HOST, W3DS_SCHEME } from "./uri";
9+
import { W3DS_FILE_HOST, W3DS_SCHEME, parseFileUri } from "./uri";
1010

1111
/** Minimal MIME → file extension map for naming uploaded files. */
1212
const MIME_EXTENSIONS: Record<string, string> = {

infrastructure/web3-adapter/src/w3ds/uri.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from "vitest";
22
import {
3-
buildFileUri,
43
InvalidW3dsUriError,
4+
buildFileUri,
55
isFileUri,
66
parseFileUri,
77
} from "./uri";

0 commit comments

Comments
 (0)