@interop/was-client 0.9.2 → 0.11.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 +32 -4
- package/dist/Collection.d.ts +49 -10
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +161 -61
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +41 -12
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +87 -54
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +1 -0
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +24 -27
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +43 -2
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +90 -14
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +48 -9
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +96 -37
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +245 -90
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +6 -12
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +6 -21
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/constants.d.ts +30 -0
- package/dist/edv/constants.d.ts.map +1 -0
- package/dist/edv/constants.js +30 -0
- package/dist/edv/constants.js.map +1 -0
- package/dist/edv/index.d.ts +1 -1
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +1 -1
- package/dist/edv/index.js.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -5
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/codec.d.ts +71 -5
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +102 -7
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/content.d.ts +74 -3
- package/dist/internal/content.d.ts.map +1 -1
- package/dist/internal/content.js +78 -7
- package/dist/internal/content.js.map +1 -1
- package/dist/internal/describe.d.ts.map +1 -1
- package/dist/internal/describe.js +2 -1
- package/dist/internal/describe.js.map +1 -1
- package/dist/internal/pagination.d.ts +45 -0
- package/dist/internal/pagination.d.ts.map +1 -0
- package/dist/internal/pagination.js +53 -0
- package/dist/internal/pagination.js.map +1 -0
- package/dist/internal/paths.d.ts +4 -0
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +10 -1
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/policy.d.ts +54 -0
- package/dist/internal/policy.d.ts.map +1 -0
- package/dist/internal/policy.js +58 -0
- package/dist/internal/policy.js.map +1 -0
- package/dist/internal/request.d.ts +4 -2
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +9 -2
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/reserved.d.ts +3 -8
- package/dist/internal/reserved.d.ts.map +1 -1
- package/dist/internal/reserved.js +10 -20
- package/dist/internal/reserved.js.map +1 -1
- package/dist/internal/write.d.ts +37 -0
- package/dist/internal/write.d.ts.map +1 -0
- package/dist/internal/write.js +29 -0
- package/dist/internal/write.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The shared write orchestration: turn a codec's {@link EncodedWrite} plus a
|
|
6
|
+
* conditional-write precondition into request headers and send it. Captures the
|
|
7
|
+
* `writeHeaders(...) + send(...)` shape that `Collection.add` and `Resource.put`
|
|
8
|
+
* would otherwise each re-implement.
|
|
9
|
+
*/
|
|
10
|
+
import type { HttpResponse } from '@interop/http-client';
|
|
11
|
+
import type { EncodedWrite } from '../codec.js';
|
|
12
|
+
import type { IZcap } from '../types.js';
|
|
13
|
+
import type { ClientContext } from './request.js';
|
|
14
|
+
import type { WritePrecondition } from './conditional.js';
|
|
15
|
+
/**
|
|
16
|
+
* Sends an encoded write (`PUT`/`POST`) to a resource path, applying the
|
|
17
|
+
* encoded body (`json` or `body`), its content-type, and the conditional-write
|
|
18
|
+
* precondition. A write is never a `read`, so the response is always present
|
|
19
|
+
* (errors throw via `send`).
|
|
20
|
+
*
|
|
21
|
+
* @param context {ClientContext}
|
|
22
|
+
* @param options {object}
|
|
23
|
+
* @param options.path {string} the resource path to write
|
|
24
|
+
* @param options.method {string} `PUT` or `POST`
|
|
25
|
+
* @param options.encoded {EncodedWrite} the codec's encoded write
|
|
26
|
+
* @param [options.capability] {IZcap}
|
|
27
|
+
* @param [options.precondition] {WritePrecondition} conditional-write headers
|
|
28
|
+
* @returns {Promise<HttpResponse>}
|
|
29
|
+
*/
|
|
30
|
+
export declare function sendEncodedWrite(context: ClientContext, { path, method, encoded, capability, precondition }: {
|
|
31
|
+
path: string;
|
|
32
|
+
method: string;
|
|
33
|
+
encoded: EncodedWrite;
|
|
34
|
+
capability?: IZcap;
|
|
35
|
+
precondition?: WritePrecondition;
|
|
36
|
+
}): Promise<HttpResponse>;
|
|
37
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEzD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,aAAa,EACtB,EACE,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EACb,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,YAAY,CAAA;IACrB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC,GACA,OAAO,CAAC,YAAY,CAAC,CAUvB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { send } from './request.js';
|
|
2
|
+
import { writeHeaders } from './conditional.js';
|
|
3
|
+
/**
|
|
4
|
+
* Sends an encoded write (`PUT`/`POST`) to a resource path, applying the
|
|
5
|
+
* encoded body (`json` or `body`), its content-type, and the conditional-write
|
|
6
|
+
* precondition. A write is never a `read`, so the response is always present
|
|
7
|
+
* (errors throw via `send`).
|
|
8
|
+
*
|
|
9
|
+
* @param context {ClientContext}
|
|
10
|
+
* @param options {object}
|
|
11
|
+
* @param options.path {string} the resource path to write
|
|
12
|
+
* @param options.method {string} `PUT` or `POST`
|
|
13
|
+
* @param options.encoded {EncodedWrite} the codec's encoded write
|
|
14
|
+
* @param [options.capability] {IZcap}
|
|
15
|
+
* @param [options.precondition] {WritePrecondition} conditional-write headers
|
|
16
|
+
* @returns {Promise<HttpResponse>}
|
|
17
|
+
*/
|
|
18
|
+
export async function sendEncodedWrite(context, { path, method, encoded, capability, precondition }) {
|
|
19
|
+
const response = await send(context, {
|
|
20
|
+
path,
|
|
21
|
+
method,
|
|
22
|
+
capability,
|
|
23
|
+
json: encoded.json,
|
|
24
|
+
body: encoded.body,
|
|
25
|
+
headers: writeHeaders(encoded.contentType, precondition)
|
|
26
|
+
});
|
|
27
|
+
return response;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAG/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAsB,EACtB,EACE,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EAOb;IAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;QACnC,IAAI;QACJ,MAAM;QACN,UAAU;QACV,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC;KACzD,CAAC,CAAA;IACF,OAAO,QAAwB,CAAA;AACjC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ import type { IZcap, IDelegatedZcap } from '@interop/data-integrity-core/zcap';
|
|
|
16
16
|
import type { ISigner } from '@interop/data-integrity-core';
|
|
17
17
|
import type { ActionInput } from '@interop/storage-core';
|
|
18
18
|
export type { IZcap, IDelegatedZcap, ISigner };
|
|
19
|
+
/**
|
|
20
|
+
* Re-export the shared WAS wire model from `@interop/storage-core`. The
|
|
21
|
+
* resources-in-a-collection listing is `CollectionResourcesList` (formerly
|
|
22
|
+
* `ResourceListing`) and the collections-in-a-space listing is `CollectionsList`
|
|
23
|
+
* (formerly `CollectionListing`).
|
|
24
|
+
*/
|
|
19
25
|
export type { Action, ActionInput, SpaceDescription, CollectionDescription, CollectionEncryption, PolicyDocument, LinkSet, LinkSetEntry, CollectionSummary, CollectionsList, SpaceSummary, SpaceListing, ResourceSummary, CollectionResourcesList, ResourceMetadata, ResourceMetadataCustom, ImportStats, BackendReference, BackendDescriptor, BackendRegistration, BackendConnectionInput, BackendConnectionPublic, StorageLimit, CollectionUsage, BackendUsage, SpaceQuotaReport } from '@interop/storage-core';
|
|
20
26
|
/**
|
|
21
27
|
* A JSON-serializable value, the shape stored for JSON resources and
|
|
@@ -27,6 +33,14 @@ export interface JsonObject {
|
|
|
27
33
|
}
|
|
28
34
|
export type JsonArray = Json[];
|
|
29
35
|
export type Json = JsonPrimitive | JsonObject | JsonArray;
|
|
36
|
+
/**
|
|
37
|
+
* The value accepted by a resource write (`put`/`add`): a JSON object or array,
|
|
38
|
+
* or binary as a `Blob`/`Uint8Array`. A top-level JSON primitive
|
|
39
|
+
* (`string`/`number`/`boolean`/`null`) is intentionally excluded -- the wire and
|
|
40
|
+
* EDV paths only carry container JSON, so wrap a bare primitive in an object or
|
|
41
|
+
* array before storing it.
|
|
42
|
+
*/
|
|
43
|
+
export type ResourceData = JsonObject | JsonArray | Blob | Uint8Array;
|
|
30
44
|
/**
|
|
31
45
|
* Return shape of `collection.add()` (server-generated resource id + location).
|
|
32
46
|
*/
|
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;;;;;;;;;;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;
|
|
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,CAA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;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAA;CAChC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,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.11.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"sideEffects": false,
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@interop/data-integrity-core": "^8.1.0",
|
|
46
|
-
"@interop/ed25519-signature": "^7.1.
|
|
47
|
-
"@interop/edv-client": "^17.
|
|
48
|
-
"@interop/ezcap": "^7.3.
|
|
46
|
+
"@interop/ed25519-signature": "^7.1.3",
|
|
47
|
+
"@interop/edv-client": "^17.3.1",
|
|
48
|
+
"@interop/ezcap": "^7.3.2",
|
|
49
49
|
"@interop/http-client": "^1.0.4",
|
|
50
|
-
"@interop/storage-core": "^0.3.
|
|
50
|
+
"@interop/storage-core": "^0.3.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@eslint/js": "^10.0.1",
|
|
54
54
|
"@interop/ed25519-verification-key": "^8.0.2",
|
|
55
|
-
"@interop/x25519-key-agreement-key": "^5.1.
|
|
55
|
+
"@interop/x25519-key-agreement-key": "^5.1.1",
|
|
56
56
|
"@playwright/test": "^1.60.0",
|
|
57
57
|
"@types/node": "^25.9.1",
|
|
58
58
|
"@vitest/coverage-v8": "^4.1.7",
|