@interop/was-client 0.26.0 → 0.27.2
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/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +27 -66
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +28 -6
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +10 -25
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +9 -19
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +31 -5
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +9 -14
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +147 -71
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +1 -2
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +19 -28
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/constants.d.ts +11 -0
- package/dist/edv/constants.d.ts.map +1 -1
- package/dist/edv/constants.js +16 -4
- package/dist/edv/constants.js.map +1 -1
- package/dist/edv/docCipher.d.ts +10 -26
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +62 -135
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/epochCrypto.d.ts +0 -4
- package/dist/edv/epochCrypto.d.ts.map +1 -1
- package/dist/edv/epochCrypto.js +4 -4
- package/dist/edv/epochCrypto.js.map +1 -1
- package/dist/edv/epochKeys.d.ts.map +1 -1
- package/dist/edv/epochKeys.js +2 -4
- package/dist/edv/epochKeys.js.map +1 -1
- package/dist/edv/epochMac.d.ts +24 -1
- package/dist/edv/epochMac.d.ts.map +1 -1
- package/dist/edv/epochMac.js +43 -13
- package/dist/edv/epochMac.js.map +1 -1
- package/dist/edv/index.d.ts +6 -4
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +4 -3
- package/dist/edv/index.js.map +1 -1
- package/dist/edv/recipients.d.ts +29 -17
- package/dist/edv/recipients.d.ts.map +1 -1
- package/dist/edv/recipients.js +177 -112
- package/dist/edv/recipients.js.map +1 -1
- package/dist/errors.d.ts +29 -12
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +37 -65
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/codec.d.ts +15 -12
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +4 -6
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/conditional.d.ts +9 -4
- package/dist/internal/conditional.d.ts.map +1 -1
- package/dist/internal/conditional.js +9 -2
- package/dist/internal/conditional.js.map +1 -1
- package/dist/internal/content.d.ts +28 -24
- package/dist/internal/content.d.ts.map +1 -1
- package/dist/internal/content.js +28 -13
- package/dist/internal/content.js.map +1 -1
- package/dist/internal/describe.d.ts +15 -2
- package/dist/internal/describe.d.ts.map +1 -1
- package/dist/internal/describe.js +17 -0
- package/dist/internal/describe.js.map +1 -1
- package/dist/internal/pagination.d.ts +20 -1
- package/dist/internal/pagination.d.ts.map +1 -1
- package/dist/internal/pagination.js +22 -0
- package/dist/internal/pagination.js.map +1 -1
- package/dist/internal/paths.d.ts +0 -11
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +20 -33
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/policy.d.ts.map +1 -1
- package/dist/internal/policy.js +2 -9
- package/dist/internal/policy.js.map +1 -1
- package/dist/internal/write.d.ts +50 -4
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +45 -0
- package/dist/internal/write.js.map +1 -1
- package/dist/sync/cid.d.ts.map +1 -1
- package/dist/sync/cid.js +8 -2
- package/dist/sync/cid.js.map +1 -1
- package/dist/sync/port.d.ts +9 -8
- package/dist/sync/port.d.ts.map +1 -1
- package/dist/sync/port.js +74 -70
- package/dist/sync/port.js.map +1 -1
- package/dist/sync/provisioning.d.ts +4 -1
- package/dist/sync/provisioning.d.ts.map +1 -1
- package/dist/sync/provisioning.js +11 -2
- package/dist/sync/provisioning.js.map +1 -1
- package/dist/sync/types.d.ts +7 -10
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -14
|
@@ -8,12 +8,25 @@
|
|
|
8
8
|
* place. Also owns the masked-404 fail-closed policy: WAS returns 404 for both
|
|
9
9
|
* not-found and unauthorized, so a `null` description is ambiguous and an
|
|
10
10
|
* operation that must know the current state fails closed via
|
|
11
|
-
* `unreadableDescriptionError` rather than guessing.
|
|
11
|
+
* `unreadableDescriptionError` rather than guessing. `collectionWritableFields`
|
|
12
|
+
* lives here too: it is the one inclusion rule for the writable description
|
|
13
|
+
* fields, shared by every path that builds a description body.
|
|
12
14
|
*/
|
|
13
15
|
import type { HttpResponse } from '@interop/http-client';
|
|
14
16
|
import type { ClientContext } from './request.js';
|
|
15
17
|
import type { WasError } from '../errors.js';
|
|
16
|
-
import type { CollectionDescription, IZcap } from '../types.js';
|
|
18
|
+
import type { CollectionDescription, CollectionWritableFields, IZcap } from '../types.js';
|
|
19
|
+
/**
|
|
20
|
+
* Picks the writable Collection Description fields that are set. The one
|
|
21
|
+
* inclusion rule (`!== undefined`) behind every description body -- the
|
|
22
|
+
* `configure` / `replaceDescription` request bodies and their echoed return
|
|
23
|
+
* descriptions, and `Space.createCollection`'s create body -- so the paths
|
|
24
|
+
* cannot drift and a new writable field is added in one place.
|
|
25
|
+
*
|
|
26
|
+
* @param fields {CollectionWritableFields}
|
|
27
|
+
* @returns {CollectionWritableFields}
|
|
28
|
+
*/
|
|
29
|
+
export declare function collectionWritableFields(fields: CollectionWritableFields): CollectionWritableFields;
|
|
17
30
|
/**
|
|
18
31
|
* Sends the Collection Description GET, returning the raw response -- or
|
|
19
32
|
* `null` if the collection is missing or not visible to you (WAS returns 404
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAKjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,EACN,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,wBAAwB,CAM1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,aAAa,EACtB,EACE,OAAO,EACP,YAAY,EACZ,UAAU,EACX,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GAC/D,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAO9B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACrE,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAIvC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,WAAW,EACX,MAAM,EACN,UAA4B,EAC7B,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAA;CAC/C,GAAG,QAAQ,CAQX"}
|
|
@@ -2,6 +2,23 @@ import { send } from './request.js';
|
|
|
2
2
|
import { dataOrNull } from './content.js';
|
|
3
3
|
import { collectionPath } from './paths.js';
|
|
4
4
|
import { ValidationError } from '../errors.js';
|
|
5
|
+
/**
|
|
6
|
+
* Picks the writable Collection Description fields that are set. The one
|
|
7
|
+
* inclusion rule (`!== undefined`) behind every description body -- the
|
|
8
|
+
* `configure` / `replaceDescription` request bodies and their echoed return
|
|
9
|
+
* descriptions, and `Space.createCollection`'s create body -- so the paths
|
|
10
|
+
* cannot drift and a new writable field is added in one place.
|
|
11
|
+
*
|
|
12
|
+
* @param fields {CollectionWritableFields}
|
|
13
|
+
* @returns {CollectionWritableFields}
|
|
14
|
+
*/
|
|
15
|
+
export function collectionWritableFields(fields) {
|
|
16
|
+
return {
|
|
17
|
+
...(fields.name !== undefined && { name: fields.name }),
|
|
18
|
+
...(fields.backend !== undefined && { backend: fields.backend }),
|
|
19
|
+
...(fields.encryption !== undefined && { encryption: fields.encryption })
|
|
20
|
+
};
|
|
21
|
+
}
|
|
5
22
|
/**
|
|
6
23
|
* Sends the Collection Description GET, returning the raw response -- or
|
|
7
24
|
* `null` if the collection is missing or not visible to you (WAS returns 404
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA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EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,GAAG;QACH,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC7C,CAAA;AACH,CAAC"}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* List Collections (`CollectionsList`), and List Spaces (`SpaceListing`). Each
|
|
16
16
|
* envelope shares the `{ items, next? }` shape the traversal relies on.
|
|
17
17
|
*/
|
|
18
|
-
import type { CollectionResourcesList, ResourceSummary } from '../types.js';
|
|
18
|
+
import type { CollectionResourcesList, IZcap, ResourceSummary } from '../types.js';
|
|
19
|
+
import type { ClientContext } from './request.js';
|
|
19
20
|
/**
|
|
20
21
|
* The shared shape of every paginated listing envelope: an `items` array and an
|
|
21
22
|
* optional `next` continuation URL. The traversal core only ever touches these
|
|
@@ -51,6 +52,24 @@ export declare function buildPageWalk<T extends PageEnvelope = CollectionResourc
|
|
|
51
52
|
firstUrl: string;
|
|
52
53
|
fetchPage: PageWalk<T>['fetchPage'];
|
|
53
54
|
}): Promise<PageWalk<T> | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Builds a {@link PageWalk} whose every page is fetched with the same signed,
|
|
57
|
+
* null-on-404 `GET` -- the one traversal shape shared by all three authorized
|
|
58
|
+
* WAS listings (Collection items, Collections, Spaces), which differ only in
|
|
59
|
+
* the first URL, the envelope type, and whether a capability is bound. Returns
|
|
60
|
+
* `null` when the first page is missing/unauthorized (404 conflation caveat).
|
|
61
|
+
*
|
|
62
|
+
* @param context {ClientContext}
|
|
63
|
+
* @param options {object}
|
|
64
|
+
* @param options.firstUrl {string} the absolute listing URL
|
|
65
|
+
* @param [options.capability] {IZcap} capability attached to every page
|
|
66
|
+
* request
|
|
67
|
+
* @returns {Promise<PageWalk<T> | null>}
|
|
68
|
+
*/
|
|
69
|
+
export declare function signedPageWalk<T extends PageEnvelope = CollectionResourcesList>(context: ClientContext, { firstUrl, capability }: {
|
|
70
|
+
firstUrl: string;
|
|
71
|
+
capability?: IZcap;
|
|
72
|
+
}): Promise<PageWalk<T> | null>;
|
|
54
73
|
/**
|
|
55
74
|
* Lazily walks a list response page by page, yielding the first page and then
|
|
56
75
|
* each page reached by following `next`. Each `next` is resolved relative to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/internal/pagination.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/internal/pagination.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EACV,uBAAuB,EACvB,KAAK,EACL,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD;;;;GAIG;AACH,KAAK,YAAY,GAAG;IAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD;;;;GAIG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,YAAY,GAAG,uBAAuB;IACxE,KAAK,EAAE,CAAC,CAAA;IACR,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;CAC9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CACjC,CAAC,SAAS,YAAY,GAAG,uBAAuB,EAChD,EACA,QAAQ,EACR,SAAS,EACV,EAAE;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;CACpC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,C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fetching the first page with the same
|
|
3
5
|
* `fetchPage` used for every following page -- the shared shape of the signed
|
|
@@ -14,6 +16,26 @@ export async function buildPageWalk({ firstUrl, fetchPage }) {
|
|
|
14
16
|
const first = await fetchPage(firstUrl);
|
|
15
17
|
return first === null ? null : { first, firstUrl, fetchPage };
|
|
16
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Builds a {@link PageWalk} whose every page is fetched with the same signed,
|
|
21
|
+
* null-on-404 `GET` -- the one traversal shape shared by all three authorized
|
|
22
|
+
* WAS listings (Collection items, Collections, Spaces), which differ only in
|
|
23
|
+
* the first URL, the envelope type, and whether a capability is bound. Returns
|
|
24
|
+
* `null` when the first page is missing/unauthorized (404 conflation caveat).
|
|
25
|
+
*
|
|
26
|
+
* @param context {ClientContext}
|
|
27
|
+
* @param options {object}
|
|
28
|
+
* @param options.firstUrl {string} the absolute listing URL
|
|
29
|
+
* @param [options.capability] {IZcap} capability attached to every page
|
|
30
|
+
* request
|
|
31
|
+
* @returns {Promise<PageWalk<T> | null>}
|
|
32
|
+
*/
|
|
33
|
+
export async function signedPageWalk(context, { firstUrl, capability }) {
|
|
34
|
+
return buildPageWalk({
|
|
35
|
+
firstUrl,
|
|
36
|
+
fetchPage: async (url) => dataOrNull(await send(context, { url, method: 'GET', capability, read: true }))
|
|
37
|
+
});
|
|
38
|
+
}
|
|
17
39
|
/**
|
|
18
40
|
* Lazily walks a list response page by page, yielding the first page and then
|
|
19
41
|
* each page reached by following `next`. Each `next` is resolved relative to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/internal/pagination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/internal/pagination.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAoBzC;;;;;;;;;;;GAW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AAC,IAAI,CAAC,CAAA;IACxB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,CAC9B,KAA6C;IAE7C,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC/B,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;AACH,CAAC"}
|
package/dist/internal/paths.d.ts
CHANGED
|
@@ -117,17 +117,6 @@ export declare function resourcePolicy(spaceId: string, collectionId: string, re
|
|
|
117
117
|
* @returns {string}
|
|
118
118
|
*/
|
|
119
119
|
export declare function resourceChunkPath(spaceId: string, collectionId: string, resourceId: string, chunkIndex: number): string;
|
|
120
|
-
/**
|
|
121
|
-
* `/space/:spaceId/:collectionId/:resourceId/chunks/` -- the chunk-listing
|
|
122
|
-
* (container) form of a chunked Resource (trailing slash is canonical). A
|
|
123
|
-
* reader discovers the chunk count here, then fetches `0..count-1`.
|
|
124
|
-
*
|
|
125
|
-
* @param spaceId {string}
|
|
126
|
-
* @param collectionId {string}
|
|
127
|
-
* @param resourceId {string}
|
|
128
|
-
* @returns {string}
|
|
129
|
-
*/
|
|
130
|
-
export declare function chunksContainerPath(spaceId: string, collectionId: string, resourceId: string): string;
|
|
131
120
|
/**
|
|
132
121
|
* Resolves a path against the server base URL, producing an absolute URL
|
|
133
122
|
* string suitable for zcap `invocationTarget`s.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/internal/paths.ts"],"names":[],"mappings":"AA+EA;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OA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ACT,MAAM,EACP,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,eAAe,GAAG,IAAI,CAazB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA0CvE"}
|
package/dist/internal/paths.js
CHANGED
|
@@ -83,57 +83,57 @@ export function spacePath(spaceId) {
|
|
|
83
83
|
* `/space/:spaceId/` -- create a collection within a space (trailing slash).
|
|
84
84
|
*/
|
|
85
85
|
export function spaceItems(spaceId) {
|
|
86
|
-
return
|
|
86
|
+
return `${spacePath(spaceId)}/`;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* `/space/:spaceId/collections/` -- list collections (trailing slash).
|
|
90
90
|
*/
|
|
91
91
|
export function spaceCollections(spaceId) {
|
|
92
|
-
return
|
|
92
|
+
return `${spacePath(spaceId)}/collections/`;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* `/space/:spaceId/export` -- export a space as a tar archive.
|
|
96
96
|
*/
|
|
97
97
|
export function spaceExport(spaceId) {
|
|
98
|
-
return
|
|
98
|
+
return `${spacePath(spaceId)}/export`;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* `/space/:spaceId/import` -- import a tar archive into a space.
|
|
102
102
|
*/
|
|
103
103
|
export function spaceImport(spaceId) {
|
|
104
|
-
return
|
|
104
|
+
return `${spacePath(spaceId)}/import`;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* `/space/:spaceId/backends` -- the backends available within a space (list, and
|
|
108
108
|
* register a new `external` backend).
|
|
109
109
|
*/
|
|
110
110
|
export function spaceBackends(spaceId) {
|
|
111
|
-
return
|
|
111
|
+
return `${spacePath(spaceId)}/backends`;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* `/space/:spaceId/backends/:backendId` -- a single registered `external`
|
|
115
115
|
* backend (replace / deregister by id).
|
|
116
116
|
*/
|
|
117
117
|
export function registeredBackend(spaceId, backendId) {
|
|
118
|
-
return
|
|
118
|
+
return `${spaceBackends(spaceId)}/${encode(backendId)}`;
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* `/space/:spaceId/quotas` -- the space-level storage quota report.
|
|
122
122
|
*/
|
|
123
123
|
export function spaceQuotas(spaceId) {
|
|
124
|
-
return
|
|
124
|
+
return `${spacePath(spaceId)}/quotas`;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* `/space/:spaceId/policy` -- the space-level access-control policy resource.
|
|
128
128
|
*/
|
|
129
129
|
export function spacePolicy(spaceId) {
|
|
130
|
-
return
|
|
130
|
+
return `${spacePath(spaceId)}/policy`;
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
* `/space/:spaceId/linkset` -- the space-level linkset (policy discovery).
|
|
134
134
|
*/
|
|
135
135
|
export function spaceLinkset(spaceId) {
|
|
136
|
-
return
|
|
136
|
+
return `${spacePath(spaceId)}/linkset`;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* `/space/:spaceId/zcaps/revocations/:capabilityId` -- submit a revocation of a
|
|
@@ -144,77 +144,77 @@ export function spaceLinkset(spaceId) {
|
|
|
144
144
|
* deeper than any Collection or Resource route, so it shadows nothing.
|
|
145
145
|
*/
|
|
146
146
|
export function spaceRevocation(spaceId, capabilityId) {
|
|
147
|
-
return
|
|
147
|
+
return `${spacePath(spaceId)}/zcaps/revocations/${encode(capabilityId)}`;
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* `/space/:spaceId/:collectionId` -- get / update / delete a collection
|
|
151
151
|
* (no trailing slash).
|
|
152
152
|
*/
|
|
153
153
|
export function collectionPath(spaceId, collectionId) {
|
|
154
|
-
return
|
|
154
|
+
return `${spacePath(spaceId)}/${encodeCollectionId(collectionId)}`;
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
157
|
* `/space/:spaceId/:collectionId/` -- list items / add a resource
|
|
158
158
|
* (trailing slash).
|
|
159
159
|
*/
|
|
160
160
|
export function collectionItems(spaceId, collectionId) {
|
|
161
|
-
return
|
|
161
|
+
return `${collectionPath(spaceId, collectionId)}/`;
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* `/space/:spaceId/:collectionId/policy` -- the collection-level access-control
|
|
165
165
|
* policy resource.
|
|
166
166
|
*/
|
|
167
167
|
export function collectionPolicy(spaceId, collectionId) {
|
|
168
|
-
return
|
|
168
|
+
return `${collectionPath(spaceId, collectionId)}/policy`;
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* `/space/:spaceId/:collectionId/linkset` -- the collection-level linkset
|
|
172
172
|
* (policy discovery).
|
|
173
173
|
*/
|
|
174
174
|
export function collectionLinkset(spaceId, collectionId) {
|
|
175
|
-
return
|
|
175
|
+
return `${collectionPath(spaceId, collectionId)}/linkset`;
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* `/space/:spaceId/:collectionId/backend` -- the "Collection Backend Selected"
|
|
179
179
|
* descriptor (the backend this collection is stored on).
|
|
180
180
|
*/
|
|
181
181
|
export function collectionBackend(spaceId, collectionId) {
|
|
182
|
-
return
|
|
182
|
+
return `${collectionPath(spaceId, collectionId)}/backend`;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* `/space/:spaceId/:collectionId/quota` -- the per-collection storage quota
|
|
186
186
|
* report (spec "Quotas").
|
|
187
187
|
*/
|
|
188
188
|
export function collectionQuota(spaceId, collectionId) {
|
|
189
|
-
return
|
|
189
|
+
return `${collectionPath(spaceId, collectionId)}/quota`;
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
192
|
* `/space/:spaceId/:collectionId/query` -- the collection-level query endpoint,
|
|
193
193
|
* whose body's `profile` selects the query (e.g. `changes`, `blinded-index`).
|
|
194
194
|
*/
|
|
195
195
|
export function collectionQuery(spaceId, collectionId) {
|
|
196
|
-
return
|
|
196
|
+
return `${collectionPath(spaceId, collectionId)}/query`;
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
199
|
* `/space/:spaceId/:collectionId/:resourceId` -- get / put / delete a resource
|
|
200
200
|
* (no trailing slash).
|
|
201
201
|
*/
|
|
202
202
|
export function resourcePath(spaceId, collectionId, resourceId) {
|
|
203
|
-
return
|
|
203
|
+
return `${collectionPath(spaceId, collectionId)}/${encodeResourceId(resourceId)}`;
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
206
|
* `/space/:spaceId/:collectionId/:resourceId/meta` -- the resource metadata
|
|
207
207
|
* object (server-managed properties plus the user-writable `custom` object).
|
|
208
208
|
*/
|
|
209
209
|
export function resourceMeta(spaceId, collectionId, resourceId) {
|
|
210
|
-
return
|
|
210
|
+
return `${resourcePath(spaceId, collectionId, resourceId)}/meta`;
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* `/space/:spaceId/:collectionId/:resourceId/policy` -- the resource-level
|
|
214
214
|
* access-control policy resource.
|
|
215
215
|
*/
|
|
216
216
|
export function resourcePolicy(spaceId, collectionId, resourceId) {
|
|
217
|
-
return
|
|
217
|
+
return `${resourcePath(spaceId, collectionId, resourceId)}/policy`;
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* `/space/:spaceId/:collectionId/:resourceId/chunks/:chunkIndex` -- a single
|
|
@@ -232,19 +232,6 @@ export function resourcePolicy(spaceId, collectionId, resourceId) {
|
|
|
232
232
|
export function resourceChunkPath(spaceId, collectionId, resourceId, chunkIndex) {
|
|
233
233
|
return `${resourcePath(spaceId, collectionId, resourceId)}/chunks/${chunkIndex}`;
|
|
234
234
|
}
|
|
235
|
-
/**
|
|
236
|
-
* `/space/:spaceId/:collectionId/:resourceId/chunks/` -- the chunk-listing
|
|
237
|
-
* (container) form of a chunked Resource (trailing slash is canonical). A
|
|
238
|
-
* reader discovers the chunk count here, then fetches `0..count-1`.
|
|
239
|
-
*
|
|
240
|
-
* @param spaceId {string}
|
|
241
|
-
* @param collectionId {string}
|
|
242
|
-
* @param resourceId {string}
|
|
243
|
-
* @returns {string}
|
|
244
|
-
*/
|
|
245
|
-
export function chunksContainerPath(spaceId, collectionId, resourceId) {
|
|
246
|
-
return `${resourcePath(spaceId, collectionId, resourceId)}/chunks/`;
|
|
247
|
-
}
|
|
248
235
|
/**
|
|
249
236
|
* Resolves a path against the server base URL, producing an absolute URL
|
|
250
237
|
* string suitable for zcap `invocationTarget`s.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/internal/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;;;;;;;GAUG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC1D,MAAM,IAAI,eAAe,CACvB,cAAc,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,+BAA+B;YAClE,qDAAqD,CACxD,CAAA;IACH,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,OAAe;IAC7B,aAAa,CAAC,OAAO,CAAC,CAAA;IACtB,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,kBAAkB,CAAC,YAAoB;IAC9C,iBAAiB,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;IAC3D,OAAO,MAAM,CAAC,YAAY,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CAAC,UA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C,CAAC,CAAW;YAC/B,UAAU,EAAE,IAAI,CAAC,CAAC,CAAW;SAC9B,CAAA;IACH,CAAC;IACD,qEAAqE;IACrE,uDAAuD;IACvD,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;AAC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/internal/policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/internal/policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAExD;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,aAAa,EACtB,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACrE,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAEhC;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,aAAa,EACtB,EACE,UAAU,EACV,MAAM,EACN,UAAU,EACX,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACpE,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GAClD,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,aAAa,EACtB,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACrE,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,aAAa,EACtB,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACrE,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
package/dist/internal/policy.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { send } from './request.js';
|
|
2
|
-
import { dataOrNull } from './content.js';
|
|
1
|
+
import { readData, send } from './request.js';
|
|
3
2
|
/**
|
|
4
3
|
* Reads the access-control policy at `policyPath`. Returns `null` when no policy
|
|
5
4
|
* is set (or it is not visible to you).
|
|
@@ -11,13 +10,7 @@ import { dataOrNull } from './content.js';
|
|
|
11
10
|
* @returns {Promise<PolicyDocument | null>}
|
|
12
11
|
*/
|
|
13
12
|
export async function readPolicy(context, { policyPath, capability }) {
|
|
14
|
-
|
|
15
|
-
path: policyPath,
|
|
16
|
-
method: 'GET',
|
|
17
|
-
capability,
|
|
18
|
-
read: true
|
|
19
|
-
});
|
|
20
|
-
return dataOrNull(response);
|
|
13
|
+
return readData(context, { path: policyPath, capability });
|
|
21
14
|
}
|
|
22
15
|
/**
|
|
23
16
|
* Sets (creates or replaces) the access-control policy at `policyPath`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/internal/policy.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"policy.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AChB,UAAU;QACV,UAAU,EAAE,IAAI;KACjB,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/internal/write.d.ts
CHANGED
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
* The shared write orchestration. `sendEncodedWrite` turns a codec's
|
|
6
6
|
* {@link EncodedWrite} plus a conditional-write precondition into request
|
|
7
7
|
* headers and sends it (the shape `Collection.add` and `Resource.put` would
|
|
8
|
-
* otherwise each re-implement).
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* otherwise each re-implement). Two flows layer on top: `insertResource` (the
|
|
9
|
+
* create path behind `Collection.add` -- encode, the minted-id `PUT` vs
|
|
10
|
+
* server-minting `POST` branch, and the precondition selection) and
|
|
11
|
+
* `upsertResource` (the write-by-id path behind `Resource.put` -- the
|
|
12
|
+
* conditional-codec pre-read of the current document, the codec-vs-caller
|
|
13
|
+
* precondition selection, and the masked-404 policy for a document that exists
|
|
14
|
+
* but is not readable with the bound capability).
|
|
12
15
|
*/
|
|
13
16
|
import type { HttpResponse } from '@interop/http-client';
|
|
14
17
|
import type { EncodedWrite, ResourceCodec } from '../codec.js';
|
|
@@ -37,6 +40,49 @@ export declare function sendEncodedWrite(context: ClientContext, { path, method,
|
|
|
37
40
|
capability?: IZcap;
|
|
38
41
|
precondition?: WritePrecondition;
|
|
39
42
|
}): Promise<HttpResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a resource with a codec-minted or server-minted id (insert) through
|
|
45
|
+
* its codec, owning the create orchestration in one place: the encode, the
|
|
46
|
+
* `PUT`-vs-`POST` branch, and the precondition selection.
|
|
47
|
+
*
|
|
48
|
+
* A codec that mints its own id (e.g. the encrypting codec's EDV id) writes it
|
|
49
|
+
* by `PUT` to that id's path; a codec that mints none (the identity codec)
|
|
50
|
+
* `POST`s to the items path and lets the server mint one. As in
|
|
51
|
+
* {@link upsertResource}, a conditional codec computes the precondition itself
|
|
52
|
+
* (the EDV codec guards its fresh insert with `If-None-Match: *`) and a
|
|
53
|
+
* non-conditional one defers to the caller's explicit precondition.
|
|
54
|
+
*
|
|
55
|
+
* Returns the codec's encoded write and the path actually written alongside the
|
|
56
|
+
* response, so the caller can shape its result (the created id and URL) without
|
|
57
|
+
* re-deriving either.
|
|
58
|
+
*
|
|
59
|
+
* @param context {ClientContext}
|
|
60
|
+
* @param options {object}
|
|
61
|
+
* @param options.itemsPath {string} the collection's items path, the
|
|
62
|
+
* `POST` target when the codec mints no id
|
|
63
|
+
* @param options.pathForId {function} builds the resource path for a
|
|
64
|
+
* codec-minted id
|
|
65
|
+
* @param options.codec {ResourceCodec} the collection's resolved codec
|
|
66
|
+
* @param options.data {ResourceData} the plaintext value
|
|
67
|
+
* @param [options.contentType] {string} caller-supplied content type
|
|
68
|
+
* @param [options.capability] {IZcap}
|
|
69
|
+
* @param [options.precondition] {WritePrecondition} the caller's explicit
|
|
70
|
+
* precondition (used only for a non-conditional codec)
|
|
71
|
+
* @returns {Promise<{ encoded: EncodedWrite; path: string; response: HttpResponse }>}
|
|
72
|
+
*/
|
|
73
|
+
export declare function insertResource(context: ClientContext, { itemsPath, pathForId, codec, data, contentType, capability, precondition }: {
|
|
74
|
+
itemsPath: string;
|
|
75
|
+
pathForId: (id: string) => string;
|
|
76
|
+
codec: ResourceCodec;
|
|
77
|
+
data: ResourceData;
|
|
78
|
+
contentType?: string;
|
|
79
|
+
capability?: IZcap;
|
|
80
|
+
precondition?: WritePrecondition;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
encoded: EncodedWrite;
|
|
83
|
+
path: string;
|
|
84
|
+
response: HttpResponse;
|
|
85
|
+
}>;
|
|
40
86
|
/**
|
|
41
87
|
* Creates or replaces a resource by id (upsert) through its codec, owning the
|
|
42
88
|
* conditional-write orchestration in one place:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":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E,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC,CAc1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,aAAa,EACtB,EACE,IAAI,EACJ,KAAK,EACL,EAAE,EACF,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,YAAY,EACb,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,aAAa,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC,GACA,OAAO,CAAC,YAAY,CAAC,CAgEvB"}
|
package/dist/internal/write.js
CHANGED
|
@@ -31,6 +31,51 @@ export async function sendEncodedWrite(context, { path, method, encoded, capabil
|
|
|
31
31
|
});
|
|
32
32
|
return response;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a resource with a codec-minted or server-minted id (insert) through
|
|
36
|
+
* its codec, owning the create orchestration in one place: the encode, the
|
|
37
|
+
* `PUT`-vs-`POST` branch, and the precondition selection.
|
|
38
|
+
*
|
|
39
|
+
* A codec that mints its own id (e.g. the encrypting codec's EDV id) writes it
|
|
40
|
+
* by `PUT` to that id's path; a codec that mints none (the identity codec)
|
|
41
|
+
* `POST`s to the items path and lets the server mint one. As in
|
|
42
|
+
* {@link upsertResource}, a conditional codec computes the precondition itself
|
|
43
|
+
* (the EDV codec guards its fresh insert with `If-None-Match: *`) and a
|
|
44
|
+
* non-conditional one defers to the caller's explicit precondition.
|
|
45
|
+
*
|
|
46
|
+
* Returns the codec's encoded write and the path actually written alongside the
|
|
47
|
+
* response, so the caller can shape its result (the created id and URL) without
|
|
48
|
+
* re-deriving either.
|
|
49
|
+
*
|
|
50
|
+
* @param context {ClientContext}
|
|
51
|
+
* @param options {object}
|
|
52
|
+
* @param options.itemsPath {string} the collection's items path, the
|
|
53
|
+
* `POST` target when the codec mints no id
|
|
54
|
+
* @param options.pathForId {function} builds the resource path for a
|
|
55
|
+
* codec-minted id
|
|
56
|
+
* @param options.codec {ResourceCodec} the collection's resolved codec
|
|
57
|
+
* @param options.data {ResourceData} the plaintext value
|
|
58
|
+
* @param [options.contentType] {string} caller-supplied content type
|
|
59
|
+
* @param [options.capability] {IZcap}
|
|
60
|
+
* @param [options.precondition] {WritePrecondition} the caller's explicit
|
|
61
|
+
* precondition (used only for a non-conditional codec)
|
|
62
|
+
* @returns {Promise<{ encoded: EncodedWrite; path: string; response: HttpResponse }>}
|
|
63
|
+
*/
|
|
64
|
+
export async function insertResource(context, { itemsPath, pathForId, codec, data, contentType, capability, precondition }) {
|
|
65
|
+
const encoded = await codec.encode({ data, contentType });
|
|
66
|
+
const chosen = codec.conditionalWrites
|
|
67
|
+
? encodedPrecondition(encoded)
|
|
68
|
+
: precondition;
|
|
69
|
+
const path = encoded.id !== undefined ? pathForId(encoded.id) : itemsPath;
|
|
70
|
+
const response = await sendEncodedWrite(context, {
|
|
71
|
+
path,
|
|
72
|
+
method: encoded.id !== undefined ? 'PUT' : 'POST',
|
|
73
|
+
capability,
|
|
74
|
+
encoded,
|
|
75
|
+
precondition: chosen
|
|
76
|
+
});
|
|
77
|
+
return { encoded, path, response };
|
|
78
|
+
}
|
|
34
79
|
/**
|
|
35
80
|
* Creates or replaces a resource by id (upsert) through its codec, owning the
|
|
36
81
|
* conditional-write orchestration in one place:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/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,4EAA4E;IAC5E,oEAAoE;IACpE,MAAM,MAAM,GAAG,KAAK,CAAC,iBAAiB;QACpC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC;QAC9B,CAAC,CAAC,YAAY,CAAA;IAChB,IAAI,CAAC;QACH,OAAO,MAAM,gBAAgB,CAAC,OAAO,EAAE;YACrC,IAAI;YACJ,MAAM,EAAE,KAAK;YACb,UAAU;YACV,OAAO;YACP,YAAY,EAAE,MAAM;SACrB,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IACE,GAAG,YAAY,uBAAuB;YACtC,KAAK,CAAC,iBAAiB;YACvB,OAAO,KAAK,IAAI,EAChB,CAAC;YACD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;YACxD,MAAM,IAAI,uBAAuB,CAC/B,kCAAkC,IAAI,gCAAgC;gBACpE,0DAA0D;gBAC1D,kEAAkE;gBAClE,gEAAgE;gBAChE,+DAA+D;gBAC/D,WAAW,EACb,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CACzD,CAAA;QACH,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC"}
|
package/dist/sync/cid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cid.d.ts","sourceRoot":"","sources":["../../src/sync/cid.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"cid.d.ts","sourceRoot":"","sources":["../../src/sync/cid.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AASvC;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,IAAI,GAAG,MAAM,CAE5C;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAExD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|