@interop/was-client 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 +84 -18
- package/dist/Collection.d.ts +3 -3
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +3 -1
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +41 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +62 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +19 -3
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +37 -3
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +30 -4
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +44 -4
- package/dist/WasClient.js.map +1 -1
- package/dist/errors.d.ts +34 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +101 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/paths.d.ts +13 -0
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +19 -0
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/request.d.ts +20 -0
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +41 -0
- package/dist/internal/request.js.map +1 -1
- package/dist/types.d.ts +11 -131
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -6
package/dist/types.d.ts
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Shared type definitions for the WAS client
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Shared type definitions for the WAS client.
|
|
6
|
+
*
|
|
7
|
+
* The WAS wire model (containment descriptions, listing/result shapes, backend
|
|
8
|
+
* and quota shapes, the policy document, and the action vocabulary) now lives
|
|
9
|
+
* in `@interop/storage-core`; this module re-exports it so the client's public
|
|
10
|
+
* surface is unchanged for downstream consumers. It still declares the
|
|
11
|
+
* client-local shapes: the JSON helpers, the `AddResult` of `collection.add()`,
|
|
12
|
+
* the handle/delegation options, and the low-level `request()` input. ZCap and
|
|
13
|
+
* signer types are re-used from `@interop/data-integrity-core`.
|
|
9
14
|
*/
|
|
10
15
|
import type { IZcap, IDelegatedZcap } from '@interop/data-integrity-core/zcap';
|
|
11
16
|
import type { ISigner } from '@interop/data-integrity-core';
|
|
17
|
+
import type { ActionInput } from '@interop/storage-core';
|
|
12
18
|
export type { IZcap, IDelegatedZcap, ISigner };
|
|
19
|
+
export type { Action, ActionInput, SpaceDescription, CollectionDescription, PolicyDocument, LinkSet, LinkSetEntry, CollectionSummary, CollectionsList, SpaceSummary, SpaceListing, ResourceSummary, CollectionResourcesList, ResourceMetadata, ResourceMetadataCustom, ImportStats, BackendReference, BackendDescriptor, StorageLimit, CollectionUsage, BackendUsage, SpaceQuotaReport } from '@interop/storage-core';
|
|
13
20
|
/**
|
|
14
21
|
* A JSON-serializable value, the shape stored for JSON resources and
|
|
15
22
|
* descriptions.
|
|
@@ -20,115 +27,6 @@ export interface JsonObject {
|
|
|
20
27
|
}
|
|
21
28
|
export type JsonArray = Json[];
|
|
22
29
|
export type Json = JsonPrimitive | JsonObject | JsonArray;
|
|
23
|
-
/**
|
|
24
|
-
* A capability action -- an HTTP verb in its canonical uppercase form, as it
|
|
25
|
-
* appears in the signed zcap. The WAS server matches actions case-sensitively.
|
|
26
|
-
*/
|
|
27
|
-
export type Action = 'GET' | 'PUT' | 'POST' | 'DELETE';
|
|
28
|
-
/**
|
|
29
|
-
* The action input accepted by `grant()`: canonical uppercase or lowercase.
|
|
30
|
-
* Lowercase is normalized to uppercase before the zcap is signed, so a grant of
|
|
31
|
-
* `'get'` still validates on the server (which expects `'GET'`).
|
|
32
|
-
*/
|
|
33
|
-
export type ActionInput = Action | Lowercase<Action>;
|
|
34
|
-
/**
|
|
35
|
-
* A Space Description object, as returned by the server.
|
|
36
|
-
*/
|
|
37
|
-
export interface SpaceDescription {
|
|
38
|
-
id: string;
|
|
39
|
-
type: string[];
|
|
40
|
-
name?: string;
|
|
41
|
-
controller: string;
|
|
42
|
-
/** URL of the Space's linkset (policy discovery), if the server advertises it. */
|
|
43
|
-
linkset?: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* A Collection Description object, as returned by the server.
|
|
47
|
-
*/
|
|
48
|
-
export interface CollectionDescription {
|
|
49
|
-
id: string;
|
|
50
|
-
type: string[];
|
|
51
|
-
name?: string;
|
|
52
|
-
/** URL of the Collection's linkset (policy discovery), if advertised. */
|
|
53
|
-
linkset?: string;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* An access-control policy document attached to a Space, Collection, or
|
|
57
|
-
* Resource. A `type`-discriminated, open/extensible shape: the reference server
|
|
58
|
-
* recognizes `{ "type": "PublicCanRead" }` for world-readable access (see
|
|
59
|
-
* `setPublic()`); other types are server-defined.
|
|
60
|
-
*/
|
|
61
|
-
export interface PolicyDocument {
|
|
62
|
-
type: string;
|
|
63
|
-
[key: string]: unknown;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* One member of a {@link LinkSet} (RFC9264): an `anchor` plus relation keys
|
|
67
|
-
* (e.g. `https://wallet.storage/spec#policy`) mapping to arrays of link targets.
|
|
68
|
-
*/
|
|
69
|
-
export interface LinkSetEntry {
|
|
70
|
-
anchor?: string;
|
|
71
|
-
[relation: string]: unknown;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Return shape of `space.linkset()` / `collection.linkset()`: an RFC9264
|
|
75
|
-
* `application/linkset+json` document.
|
|
76
|
-
*/
|
|
77
|
-
export interface LinkSet {
|
|
78
|
-
linkset: LinkSetEntry[];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* One entry in a `CollectionListing` (a collection within a space).
|
|
82
|
-
*/
|
|
83
|
-
export interface CollectionSummary {
|
|
84
|
-
id: string;
|
|
85
|
-
name: string;
|
|
86
|
-
url: string;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Return shape of `space.collections()`.
|
|
90
|
-
*/
|
|
91
|
-
export interface CollectionListing {
|
|
92
|
-
url: string;
|
|
93
|
-
totalItems: number;
|
|
94
|
-
items: CollectionSummary[];
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* One entry in a `SpaceListing` (a space within the repository).
|
|
98
|
-
*/
|
|
99
|
-
export interface SpaceSummary {
|
|
100
|
-
id: string;
|
|
101
|
-
name?: string;
|
|
102
|
-
url: string;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Return shape of `was.listSpaces()` (not yet implemented by the reference
|
|
106
|
-
* server, which answers 501).
|
|
107
|
-
*/
|
|
108
|
-
export interface SpaceListing {
|
|
109
|
-
url: string;
|
|
110
|
-
totalItems: number;
|
|
111
|
-
items: SpaceSummary[];
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* One entry in a `ResourceListing` (a resource within a collection).
|
|
115
|
-
*/
|
|
116
|
-
export interface ResourceSummary {
|
|
117
|
-
id: string;
|
|
118
|
-
url: string;
|
|
119
|
-
contentType: string;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Return shape of `collection.list()`.
|
|
123
|
-
*/
|
|
124
|
-
export interface ResourceListing {
|
|
125
|
-
id: string;
|
|
126
|
-
url: string;
|
|
127
|
-
name?: string;
|
|
128
|
-
type: string[];
|
|
129
|
-
totalItems: number;
|
|
130
|
-
items: ResourceSummary[];
|
|
131
|
-
}
|
|
132
30
|
/**
|
|
133
31
|
* Return shape of `collection.add()` (server-generated resource id + location).
|
|
134
32
|
*/
|
|
@@ -137,17 +35,6 @@ export interface AddResult {
|
|
|
137
35
|
url: string;
|
|
138
36
|
contentType?: string;
|
|
139
37
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Return shape of `space.import()`.
|
|
142
|
-
*/
|
|
143
|
-
export interface ImportStats {
|
|
144
|
-
collectionsCreated: number;
|
|
145
|
-
collectionsSkipped: number;
|
|
146
|
-
resourcesCreated: number;
|
|
147
|
-
resourcesSkipped: number;
|
|
148
|
-
policiesCreated: number;
|
|
149
|
-
policiesSkipped: number;
|
|
150
|
-
}
|
|
151
38
|
/**
|
|
152
39
|
* Options accepted by every handle factory (`space()`, `collection()`,
|
|
153
40
|
* `resource()`). A bound `capability` is attached to every request the handle
|
|
@@ -156,13 +43,6 @@ export interface ImportStats {
|
|
|
156
43
|
export interface HandleOptions {
|
|
157
44
|
capability?: IZcap;
|
|
158
45
|
}
|
|
159
|
-
/**
|
|
160
|
-
* A reference to a storage backend, used when creating or configuring a
|
|
161
|
-
* Collection.
|
|
162
|
-
*/
|
|
163
|
-
export interface BackendReference {
|
|
164
|
-
id: string;
|
|
165
|
-
}
|
|
166
46
|
/**
|
|
167
47
|
* Options for the general delegation primitive (`was.grant()`) and the
|
|
168
48
|
* `space`/`collection` sugar.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,CAAA;AAM9C,YAAY,EACV,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,cAA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AI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,IAAI,GAAG,UAAU,CAAA;IACxB,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/was-client",
|
|
3
3
|
"description": "A developer-friendly client for Wallet Attached Storage (WAS) servers.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"lint": "eslint src test",
|
|
13
13
|
"prepare": "pnpm run build",
|
|
14
14
|
"rebuild": "pnpm run clear && pnpm run build",
|
|
15
|
-
"test": "pnpm run fix && pnpm run lint && pnpm run test
|
|
15
|
+
"test": "pnpm run fix && pnpm run lint && pnpm run test:node && pnpm run test:browser",
|
|
16
16
|
"test:browser": "playwright test",
|
|
17
17
|
"test:node": "vitest run",
|
|
18
18
|
"test:coverage": "vitest run --coverage"
|
|
@@ -35,10 +35,11 @@
|
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"sideEffects": false,
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@interop/data-integrity-core": "^
|
|
39
|
-
"@interop/ed25519-signature": "^7.
|
|
40
|
-
"@interop/ezcap": "^7.
|
|
41
|
-
"@interop/http-client": "^1.0.3"
|
|
38
|
+
"@interop/data-integrity-core": "^8.0.0",
|
|
39
|
+
"@interop/ed25519-signature": "^7.1.2",
|
|
40
|
+
"@interop/ezcap": "^7.2.1",
|
|
41
|
+
"@interop/http-client": "^1.0.3",
|
|
42
|
+
"@interop/storage-core": "^0.1.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@eslint/js": "^10.0.1",
|