@holochain/client 0.4.3 → 0.5.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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- import { AgentPubKey, CellId, DnaHash, DnaProperties, HeaderHash, HoloHash, InstalledAppId, InstalledCell, KitsuneAgent, KitsuneSpace, RoleId, Signature } from "../../types.js";
3
- import { DhtOp, Entry, Header } from "../../hdk/index.js";
2
+ import { AgentPubKey, CellId, DnaHash, DnaProperties, ActionHash, HoloHash, InstalledAppId, InstalledCell, KitsuneAgent, KitsuneSpace, RoleId, Signature } from "../../types.js";
3
+ import { DhtOp, Entry, Action } from "../../hdk/index.js";
4
4
  import { Requester } from "../common.js";
5
5
  export declare type AttachAppInterfaceRequest = {
6
6
  port: number;
@@ -274,14 +274,14 @@ export interface FullIntegrationStateDump {
274
274
  integrated: Array<DhtOp>;
275
275
  dht_ops_cursor: number;
276
276
  }
277
- export interface SourceChainJsonElement {
277
+ export interface SourceChainJsonRecord {
278
278
  signature: Signature;
279
- header_address: HeaderHash;
280
- header: Header;
279
+ action_address: ActionHash;
280
+ action: Action;
281
281
  entry: Entry | undefined;
282
282
  }
283
283
  export interface SourceChainJsonDump {
284
- elements: Array<SourceChainJsonElement>;
284
+ records: Array<SourceChainJsonRecord>;
285
285
  published_ops_count: number;
286
286
  }
287
287
  export interface FullStateDump {
@@ -1,11 +1,11 @@
1
- import { AgentPubKey, DnaHash, EntryHash, HeaderHash, HoloHashed, Signature, Timestamp } from "../types.js";
1
+ import { AgentPubKey, DnaHash, EntryHash, ActionHash, HoloHashed, Signature, Timestamp } from "../types.js";
2
2
  import { EntryType } from "./entry.js";
3
- export interface SignedHeaderHashed<H extends Header = Header> {
3
+ export interface SignedActionHashed<H extends Action = Action> {
4
4
  hashed: HoloHashed<H>;
5
5
  signature: Signature;
6
6
  }
7
- export declare type HeaderHashed = HoloHashed<Header>;
8
- export declare enum HeaderType {
7
+ export declare type ActionHashed = HoloHashed<Action>;
8
+ export declare enum ActionType {
9
9
  Dna = "Dna",
10
10
  AgentValidationPkg = "AgentValidationPkg",
11
11
  InitZomesComplete = "InitZomesComplete",
@@ -17,91 +17,91 @@ export declare enum HeaderType {
17
17
  Update = "Update",
18
18
  Delete = "Delete"
19
19
  }
20
- export declare type Header = Dna | AgentValidationPkg | InitZomesComplete | CreateLink | DeleteLink | OpenChain | CloseChain | Delete | NewEntryHeader;
21
- export declare type NewEntryHeader = Create | Update;
20
+ export declare type Action = Dna | AgentValidationPkg | InitZomesComplete | CreateLink | DeleteLink | OpenChain | CloseChain | Delete | NewEntryAction;
21
+ export declare type NewEntryAction = Create | Update;
22
22
  export interface Dna {
23
- type: HeaderType.Dna;
23
+ type: ActionType.Dna;
24
24
  author: AgentPubKey;
25
25
  timestamp: Timestamp;
26
26
  hash: DnaHash;
27
27
  }
28
28
  export interface AgentValidationPkg {
29
- type: HeaderType.AgentValidationPkg;
29
+ type: ActionType.AgentValidationPkg;
30
30
  author: AgentPubKey;
31
31
  timestamp: Timestamp;
32
- header_seq: number;
33
- prev_header: HeaderHash;
32
+ action_seq: number;
33
+ prev_action: ActionHash;
34
34
  membrane_proof: any;
35
35
  }
36
36
  export interface InitZomesComplete {
37
- type: HeaderType.InitZomesComplete;
37
+ type: ActionType.InitZomesComplete;
38
38
  author: AgentPubKey;
39
39
  timestamp: Timestamp;
40
- header_seq: number;
41
- prev_header: HeaderHash;
40
+ action_seq: number;
41
+ prev_action: ActionHash;
42
42
  }
43
43
  export interface CreateLink {
44
- type: HeaderType.CreateLink;
44
+ type: ActionType.CreateLink;
45
45
  author: AgentPubKey;
46
46
  timestamp: Timestamp;
47
- header_seq: number;
48
- prev_header: HeaderHash;
47
+ action_seq: number;
48
+ prev_action: ActionHash;
49
49
  base_address: EntryHash;
50
50
  target_address: EntryHash;
51
51
  zome_id: number;
52
52
  tag: any;
53
53
  }
54
54
  export interface DeleteLink {
55
- type: HeaderType.DeleteLink;
55
+ type: ActionType.DeleteLink;
56
56
  author: AgentPubKey;
57
57
  timestamp: Timestamp;
58
- header_seq: number;
59
- prev_header: HeaderHash;
58
+ action_seq: number;
59
+ prev_action: ActionHash;
60
60
  base_address: EntryHash;
61
- link_add_address: HeaderHash;
61
+ link_add_address: ActionHash;
62
62
  }
63
63
  export interface OpenChain {
64
- type: HeaderType.OpenChain;
64
+ type: ActionType.OpenChain;
65
65
  author: AgentPubKey;
66
66
  timestamp: Timestamp;
67
- header_seq: number;
68
- prev_header: HeaderHash;
67
+ action_seq: number;
68
+ prev_action: ActionHash;
69
69
  prev_dna_hash: DnaHash;
70
70
  }
71
71
  export interface CloseChain {
72
- type: HeaderType.CloseChain;
72
+ type: ActionType.CloseChain;
73
73
  author: AgentPubKey;
74
74
  timestamp: Timestamp;
75
- header_seq: number;
76
- prev_header: HeaderHash;
75
+ action_seq: number;
76
+ prev_action: ActionHash;
77
77
  new_dna_hash: DnaHash;
78
78
  }
79
79
  export interface Update {
80
- type: HeaderType.Update;
80
+ type: ActionType.Update;
81
81
  author: AgentPubKey;
82
82
  timestamp: Timestamp;
83
- header_seq: number;
84
- prev_header: HeaderHash;
85
- original_header_address: HeaderHash;
83
+ action_seq: number;
84
+ prev_action: ActionHash;
85
+ original_action_address: ActionHash;
86
86
  original_entry_address: EntryHash;
87
87
  entry_type: EntryType;
88
88
  entry_hash: EntryHash;
89
89
  }
90
90
  export interface Delete {
91
- type: HeaderType.Delete;
91
+ type: ActionType.Delete;
92
92
  author: AgentPubKey;
93
93
  timestamp: Timestamp;
94
- header_seq: number;
95
- prev_header: HeaderHash;
96
- deletes_address: HeaderHash;
94
+ action_seq: number;
95
+ prev_action: ActionHash;
96
+ deletes_address: ActionHash;
97
97
  deletes_entry_address: EntryHash;
98
98
  }
99
99
  export interface Create {
100
- type: HeaderType.Create;
100
+ type: ActionType.Create;
101
101
  author: AgentPubKey;
102
102
  timestamp: Timestamp;
103
- header_seq: number;
104
- prev_header: HeaderHash;
103
+ action_seq: number;
104
+ prev_action: ActionHash;
105
105
  entry_type: EntryType;
106
106
  entry_hash: EntryHash;
107
107
  }
@@ -0,0 +1,14 @@
1
+ export var ActionType;
2
+ (function (ActionType) {
3
+ ActionType["Dna"] = "Dna";
4
+ ActionType["AgentValidationPkg"] = "AgentValidationPkg";
5
+ ActionType["InitZomesComplete"] = "InitZomesComplete";
6
+ ActionType["CreateLink"] = "CreateLink";
7
+ ActionType["DeleteLink"] = "DeleteLink";
8
+ ActionType["OpenChain"] = "OpenChain";
9
+ ActionType["CloseChain"] = "CloseChain";
10
+ ActionType["Create"] = "Create";
11
+ ActionType["Update"] = "Update";
12
+ ActionType["Delete"] = "Delete";
13
+ })(ActionType || (ActionType = {}));
14
+ //# sourceMappingURL=action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/hdk/header.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAN,IAAY,UAWX;AAXD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,uDAAyC,CAAA;IACzC,qDAAuC,CAAA;IACvC,uCAAyB,CAAA;IACzB,uCAAyB,CAAA;IACzB,qCAAuB,CAAA;IACvB,uCAAyB,CAAA;IACzB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EAXW,UAAU,KAAV,UAAU,QAWrB"}
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/hdk/action.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAN,IAAY,UAWX;AAXD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,uDAAyC,CAAA;IACzC,qDAAuC,CAAA;IACvC,uCAAyB,CAAA;IACzB,uCAAyB,CAAA;IACzB,qCAAuB,CAAA;IACvB,uCAAyB,CAAA;IACzB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EAXW,UAAU,KAAV,UAAU,QAWrB"}
@@ -1,23 +1,23 @@
1
1
  import { Signature } from "../types.js";
2
2
  import { Entry } from "./entry.js";
3
- import { CreateLink, Delete, DeleteLink, Header, NewEntryHeader, Update } from "./header.js";
3
+ import { CreateLink, Delete, DeleteLink, Action, NewEntryAction, Update } from "./action.js";
4
4
  export declare enum DhtOpType {
5
- StoreElement = "StoreElement",
5
+ StoreRecord = "StoreRecord",
6
6
  StoreEntry = "StoreEntry",
7
7
  RegisterAgentActivity = "RegisterAgentActivity",
8
8
  RegisterUpdatedContent = "RegisterUpdatedContent",
9
- RegisterUpdatedElement = "RegisterUpdatedElement",
9
+ RegisterUpdatedRecord = "RegisterUpdatedRecord",
10
10
  RegisterDeletedBy = "RegisterDeletedBy",
11
- RegisterDeletedEntryHeader = "RegisterDeletedEntryHeader",
11
+ RegisterDeletedEntryAction = "RegisterDeletedEntryAction",
12
12
  RegisterAddLink = "RegisterAddLink",
13
13
  RegisterRemoveLink = "RegisterRemoveLink"
14
14
  }
15
15
  export declare type DhtOp = {
16
- [DhtOpType.StoreElement]: [Signature, Header, Entry | undefined];
16
+ [DhtOpType.StoreRecord]: [Signature, Action, Entry | undefined];
17
17
  } | {
18
- [DhtOpType.StoreEntry]: [Signature, NewEntryHeader, Entry];
18
+ [DhtOpType.StoreEntry]: [Signature, NewEntryAction, Entry];
19
19
  } | {
20
- [DhtOpType.RegisterAgentActivity]: [Signature, Header];
20
+ [DhtOpType.RegisterAgentActivity]: [Signature, Action];
21
21
  } | {
22
22
  [DhtOpType.RegisterUpdatedContent]: [
23
23
  Signature,
@@ -25,21 +25,17 @@ export declare type DhtOp = {
25
25
  Entry | undefined
26
26
  ];
27
27
  } | {
28
- [DhtOpType.RegisterUpdatedElement]: [
29
- Signature,
30
- Update,
31
- Entry | undefined
32
- ];
28
+ [DhtOpType.RegisterUpdatedRecord]: [Signature, Update, Entry | undefined];
33
29
  } | {
34
30
  [DhtOpType.RegisterDeletedBy]: [Signature, Delete];
35
31
  } | {
36
- [DhtOpType.RegisterDeletedEntryHeader]: [Signature, Delete];
32
+ [DhtOpType.RegisterDeletedEntryAction]: [Signature, Delete];
37
33
  } | {
38
34
  [DhtOpType.RegisterAddLink]: [Signature, CreateLink];
39
35
  } | {
40
36
  [DhtOpType.RegisterRemoveLink]: [Signature, DeleteLink];
41
37
  };
42
38
  export declare function getDhtOpType(op: DhtOp): DhtOpType;
43
- export declare function getDhtOpHeader(op: DhtOp): Header;
39
+ export declare function getDhtOpAction(op: DhtOp): Action;
44
40
  export declare function getDhtOpEntry(op: DhtOp): Entry | undefined;
45
41
  export declare function getDhtOpSignature(op: DhtOp): Signature;
@@ -1,28 +1,28 @@
1
1
  // https://github.com/holochain/holochain/blob/develop/crates/types/src/dht_op.rs
2
2
  export var DhtOpType;
3
3
  (function (DhtOpType) {
4
- DhtOpType["StoreElement"] = "StoreElement";
4
+ DhtOpType["StoreRecord"] = "StoreRecord";
5
5
  DhtOpType["StoreEntry"] = "StoreEntry";
6
6
  DhtOpType["RegisterAgentActivity"] = "RegisterAgentActivity";
7
7
  DhtOpType["RegisterUpdatedContent"] = "RegisterUpdatedContent";
8
- DhtOpType["RegisterUpdatedElement"] = "RegisterUpdatedElement";
8
+ DhtOpType["RegisterUpdatedRecord"] = "RegisterUpdatedRecord";
9
9
  DhtOpType["RegisterDeletedBy"] = "RegisterDeletedBy";
10
- DhtOpType["RegisterDeletedEntryHeader"] = "RegisterDeletedEntryHeader";
10
+ DhtOpType["RegisterDeletedEntryAction"] = "RegisterDeletedEntryAction";
11
11
  DhtOpType["RegisterAddLink"] = "RegisterAddLink";
12
12
  DhtOpType["RegisterRemoveLink"] = "RegisterRemoveLink";
13
13
  })(DhtOpType || (DhtOpType = {}));
14
14
  export function getDhtOpType(op) {
15
15
  return Object.keys(op)[0];
16
16
  }
17
- export function getDhtOpHeader(op) {
18
- const header = Object.values(op)[0][1];
19
- if (header.author)
20
- return header;
17
+ export function getDhtOpAction(op) {
18
+ const action = Object.values(op)[0][1];
19
+ if (action.author)
20
+ return action;
21
21
  else {
22
- const headerType = Object.keys(header)[0];
22
+ const actionType = Object.keys(action)[0];
23
23
  return {
24
- type: headerType,
25
- ...header[headerType],
24
+ type: actionType,
25
+ ...action[actionType],
26
26
  };
27
27
  }
28
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dht-ops.js","sourceRoot":"","sources":["../../src/hdk/dht-ops.ts"],"names":[],"mappings":"AAWA,iFAAiF;AAEjF,MAAM,CAAN,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,0CAA6B,CAAA;IAC7B,sCAAyB,CAAA;IACzB,4DAA+C,CAAA;IAC/C,8DAAiD,CAAA;IACjD,8DAAiD,CAAA;IACjD,oDAAuC,CAAA;IACvC,sEAAyD,CAAA;IACzD,gDAAmC,CAAA;IACnC,sDAAyC,CAAA;AAC3C,CAAC,EAVW,SAAS,KAAT,SAAS,QAUpB;AAyBD,MAAM,UAAU,YAAY,CAAC,EAAS;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAc,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAS;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvC,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;SAC5B;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1C,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,GAAG,MAAM,CAAC,UAAU,CAAC;SACtB,CAAC;KACH;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,EAAS;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAAS;IACzC,OAAO,MAAM,CAAC,MAAM,CAAC,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4 +1,5 @@
1
+ export * from "./action.js";
1
2
  export * from "./capabilities.js";
2
3
  export * from "./dht-ops.js";
3
4
  export * from "./entry.js";
4
- export * from "./header.js";
5
+ export * from "./record.js";
package/lib/hdk/index.js CHANGED
@@ -1,5 +1,6 @@
1
+ export * from "./action.js";
1
2
  export * from "./capabilities.js";
2
3
  export * from "./dht-ops.js";
3
4
  export * from "./entry.js";
4
- export * from "./header.js";
5
+ export * from "./record.js";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { SignedActionHashed } from "./action.js";
2
+ export declare type Record = {
3
+ signed_action: SignedActionHashed;
4
+ entry: RecordEntry;
5
+ };
6
+ export declare type RecordEntry = {
7
+ Present: {
8
+ entry: Uint8Array;
9
+ };
10
+ } | {
11
+ Hidden: void;
12
+ } | {
13
+ NotApplicable: void;
14
+ } | {
15
+ NotStored: void;
16
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/hdk/record.ts"],"names":[],"mappings":""}
package/lib/types.d.ts CHANGED
@@ -2,7 +2,7 @@ export declare type HoloHash = Uint8Array;
2
2
  export declare type AgentPubKey = HoloHash;
3
3
  export declare type DnaHash = HoloHash;
4
4
  export declare type EntryHash = HoloHash;
5
- export declare type HeaderHash = HoloHash;
5
+ export declare type ActionHash = HoloHash;
6
6
  export declare type AnyDhtHash = HoloHash;
7
7
  export declare type KitsuneAgent = Uint8Array;
8
8
  export declare type KitsuneSpace = Uint8Array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holochain/client",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "A JavaScript client for the Holochain Conductor API",
5
5
  "author": "Holochain Foundation <info@holochain.org> (http://holochain.org)",
6
6
  "license": "CAL-1.0",
package/lib/hdk/header.js DELETED
@@ -1,14 +0,0 @@
1
- export var HeaderType;
2
- (function (HeaderType) {
3
- HeaderType["Dna"] = "Dna";
4
- HeaderType["AgentValidationPkg"] = "AgentValidationPkg";
5
- HeaderType["InitZomesComplete"] = "InitZomesComplete";
6
- HeaderType["CreateLink"] = "CreateLink";
7
- HeaderType["DeleteLink"] = "DeleteLink";
8
- HeaderType["OpenChain"] = "OpenChain";
9
- HeaderType["CloseChain"] = "CloseChain";
10
- HeaderType["Create"] = "Create";
11
- HeaderType["Update"] = "Update";
12
- HeaderType["Delete"] = "Delete";
13
- })(HeaderType || (HeaderType = {}));
14
- //# sourceMappingURL=header.js.map