@seed-hypermedia/client 0.0.1
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/LICENSE +201 -0
- package/dist/capability.d.ts +21 -0
- package/dist/change.d.ts +129 -0
- package/dist/chunk-YUKHBJYL.mjs +1044 -0
- package/dist/client.d.ts +37 -0
- package/dist/comment.d.ts +43 -0
- package/dist/contact.d.ts +42 -0
- package/dist/errors.d.ts +11 -0
- package/dist/hm-types.d.ts +43109 -0
- package/dist/hm-types.mjs +272 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.mjs +891 -0
- package/dist/ref.d.ts +65 -0
- package/dist/signing.d.ts +16 -0
- package/package.json +43 -0
package/dist/ref.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ref SDK — create signed ref blobs for document version, tombstone, and redirect operations.
|
|
3
|
+
*/
|
|
4
|
+
import type { HMPublishBlobsInput, HMSigner } from './hm-types';
|
|
5
|
+
export type CreateVersionRefInput = {
|
|
6
|
+
/** Account UID (base58btc-encoded principal) */
|
|
7
|
+
space: string;
|
|
8
|
+
/** Document path (API format, e.g., "/my-doc") */
|
|
9
|
+
path: string;
|
|
10
|
+
/** Genesis CID string */
|
|
11
|
+
genesis: string;
|
|
12
|
+
/** Version string (dot-separated CID strings) */
|
|
13
|
+
version: string;
|
|
14
|
+
/** Generation number */
|
|
15
|
+
generation: number;
|
|
16
|
+
/** Optional capability CID string */
|
|
17
|
+
capability?: string;
|
|
18
|
+
};
|
|
19
|
+
export type CreateTombstoneRefInput = {
|
|
20
|
+
/** Account UID (base58btc-encoded principal) */
|
|
21
|
+
space: string;
|
|
22
|
+
/** Document path (API format, e.g., "/my-doc") */
|
|
23
|
+
path: string;
|
|
24
|
+
/** Genesis CID string */
|
|
25
|
+
genesis: string;
|
|
26
|
+
/** Generation number */
|
|
27
|
+
generation: number;
|
|
28
|
+
/** Optional capability CID string */
|
|
29
|
+
capability?: string;
|
|
30
|
+
};
|
|
31
|
+
export type CreateRedirectRefInput = {
|
|
32
|
+
/** Account UID (base58btc-encoded principal) */
|
|
33
|
+
space: string;
|
|
34
|
+
/** Document path (API format, e.g., "/my-doc") */
|
|
35
|
+
path: string;
|
|
36
|
+
/** Genesis CID string */
|
|
37
|
+
genesis: string;
|
|
38
|
+
/** Generation number */
|
|
39
|
+
generation: number;
|
|
40
|
+
/** Target account UID (omit or set same as space if same account) */
|
|
41
|
+
targetSpace?: string;
|
|
42
|
+
/** Target document path */
|
|
43
|
+
targetPath: string;
|
|
44
|
+
/** If true, republish target content at this location */
|
|
45
|
+
republish?: boolean;
|
|
46
|
+
/** Optional capability CID string */
|
|
47
|
+
capability?: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Create a signed version ref blob ready for publishing.
|
|
51
|
+
* Points to a specific document version (genesis + heads).
|
|
52
|
+
* Used for fork/branch operations and normal document refs.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createVersionRef(input: CreateVersionRefInput, signer: HMSigner): Promise<HMPublishBlobsInput>;
|
|
55
|
+
/**
|
|
56
|
+
* Create a signed tombstone ref blob ready for publishing.
|
|
57
|
+
* Marks a document as deleted (empty heads, no redirect).
|
|
58
|
+
*/
|
|
59
|
+
export declare function createTombstoneRef(input: CreateTombstoneRefInput, signer: HMSigner): Promise<HMPublishBlobsInput>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a signed redirect ref blob ready for publishing.
|
|
62
|
+
* Redirects this document path to a different account/path.
|
|
63
|
+
* Optionally republishes the target content at this location.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createRedirectRef(input: CreateRedirectRefInput, signer: HMSigner): Promise<HMPublishBlobsInput>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal signing utilities shared across blob creation modules.
|
|
3
|
+
* Not exported from the package index.
|
|
4
|
+
*/
|
|
5
|
+
import type { HMPublishBlobsInput, HMSigner } from './hm-types';
|
|
6
|
+
export declare const cborCodec: {
|
|
7
|
+
code: 113;
|
|
8
|
+
encode: (input: unknown) => import("multiformats").ByteView<unknown>;
|
|
9
|
+
name: "DAG-CBOR";
|
|
10
|
+
};
|
|
11
|
+
export declare function normalizeBytes(data: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
12
|
+
export declare function signObject(signer: HMSigner, data: unknown): Promise<Uint8Array>;
|
|
13
|
+
export declare function toPublishInput(blobData: Uint8Array, extraBlobs?: Array<{
|
|
14
|
+
cid?: string;
|
|
15
|
+
data: Uint8Array;
|
|
16
|
+
}>): HMPublishBlobsInput;
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seed-hypermedia/client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts"
|
|
10
|
+
},
|
|
11
|
+
"./*": {
|
|
12
|
+
"import": "./dist/*.js",
|
|
13
|
+
"types": "./dist/*.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@ipld/dag-cbor": "^9.2.5",
|
|
24
|
+
"multiformats": "^13.4.1",
|
|
25
|
+
"superjson": "2.2.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"tsup": "^8.5.1",
|
|
29
|
+
"typescript": "5.8.3",
|
|
30
|
+
"vitest": "0.34.2",
|
|
31
|
+
"zod": "3.25.76"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"zod": ">=3.20.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup && tsc --project tsconfig.build.json",
|
|
38
|
+
"format:check": "prettier --check .",
|
|
39
|
+
"format:write": "prettier --write .",
|
|
40
|
+
"test": "vitest --run",
|
|
41
|
+
"typecheck": "tsc --noEmit --project tsconfig.app.json"
|
|
42
|
+
}
|
|
43
|
+
}
|