@seed-hypermedia/client 0.0.43 → 0.0.44

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/change.d.ts CHANGED
@@ -29,12 +29,12 @@ export type DocumentOperation = {
29
29
  export type CreateChangeOpsInput = {
30
30
  /** Native CBOR ops */
31
31
  ops: DocumentOperation[];
32
- /** CID of the genesis change blob */
33
- genesisCid: CID;
34
- /** CIDs of dependency changes */
35
- deps: CID[];
36
- /** Depth of the change (max depth of deps + 1) */
37
- depth: number;
32
+ /** CID of the genesis change blob. Omit when creating the first content change for a document. */
33
+ genesisCid?: CID;
34
+ /** CIDs of dependency changes. Omit when creating the first content change for a document. */
35
+ deps?: CID[];
36
+ /** Depth of the change (max depth of deps + 1). Omit when creating the first content change for a document. */
37
+ depth?: number;
38
38
  /** Timestamp (defaults to Date.now()) */
39
39
  ts?: bigint;
40
40
  };
@@ -68,7 +68,7 @@ export declare const signPreparedChange: (unsignedBytes: Uint8Array, signer: HMS
68
68
  }>;
69
69
  /**
70
70
  * Create a signed genesis Change blob (empty, ts=0).
71
- * This is the bootstrap blob for a new document, matching the web pattern.
71
+ * This deterministic sentinel is only intended for home documents.
72
72
  */
73
73
  export declare function createGenesisChange(signer: HMSigner): Promise<{
74
74
  bytes: Uint8Array;
package/dist/index.mjs CHANGED
@@ -209,11 +209,13 @@ function createChangeOps(input) {
209
209
  },
210
210
  signer: null,
211
211
  ts,
212
- sig: null,
213
- genesis: input.genesisCid,
214
- deps: input.deps,
215
- depth: input.depth
212
+ sig: null
216
213
  };
214
+ if (input.genesisCid) {
215
+ unsigned.genesis = input.genesisCid;
216
+ unsigned.deps = input.deps ?? [];
217
+ unsigned.depth = input.depth ?? 1;
218
+ }
217
219
  return { unsignedBytes: cborEncode4(unsigned), ts };
218
220
  }
219
221
  async function createChange(unsignedBytes, signer) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",