@microsoft/ccf-app 2.0.0-dev5 → 2.0.0-rc0

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/consensus.js CHANGED
@@ -2,9 +2,7 @@
2
2
  // Licensed under the Apache 2.0 License.
3
3
  /**
4
4
  * The `consensus` module provides access to consensus information
5
- * as observed by the local node. While the information will converge
6
- * on all nodes in a healthy network, it is derived from distributed
7
- * state rather than distributed itself.
5
+ * as observed by the local node.
8
6
  *
9
7
  * @module
10
8
  */
@@ -12,12 +10,12 @@ import { ccf } from "./global.js";
12
10
  /**
13
11
  * @inheritDoc CCFConsensus.getLastCommittedTxId;
14
12
  */
15
- export const getLastCommittedTxId = ccf.consensus.getLastCommittedTxId;
13
+ export const getLastCommittedTxId = ccf.consensus.getLastCommittedTxId.bind(ccf.consensus);
16
14
  /**
17
15
  * @inheritDoc CCFConsensus.getStatusForTxId;
18
16
  */
19
- export const getStatusForTxId = ccf.consensus.getStatusForTxId;
17
+ export const getStatusForTxId = ccf.consensus.getStatusForTxId.bind(ccf.consensus);
20
18
  /**
21
19
  * @inheritDoc CCFConsensus.getViewForSeqno;
22
20
  */
23
- export const getViewForSeqno = ccf.consensus.getViewForSeqno;
21
+ export const getViewForSeqno = ccf.consensus.getViewForSeqno.bind(ccf.consensus);
package/endpoints.d.ts CHANGED
@@ -46,6 +46,10 @@ export interface Request<T extends JsonCompatible<T> = any> {
46
46
  * The query string of the requested URL.
47
47
  */
48
48
  query: string;
49
+ /**
50
+ * The request path of the requested URL.
51
+ */
52
+ path: string;
49
53
  /**
50
54
  * An object to access the request body in various ways.
51
55
  */
@@ -192,4 +196,8 @@ export declare type EndpointFn<A extends JsonCompatible<A> = any, B extends Resp
192
196
  * @inheritDoc CCF.rpc.setApplyWrites
193
197
  */
194
198
  export declare const setApplyWrites: (force: boolean) => void;
199
+ /**
200
+ * @inheritDoc CCF.rpc.setClaimsDigest
201
+ */
202
+ export declare const setClaimsDigest: (digest: ArrayBuffer) => void;
195
203
  export {};
package/endpoints.js CHANGED
@@ -11,3 +11,7 @@ import { ccf } from "./global.js";
11
11
  * @inheritDoc CCF.rpc.setApplyWrites
12
12
  */
13
13
  export const setApplyWrites = ccf.rpc.setApplyWrites.bind(ccf.rpc);
14
+ /**
15
+ * @inheritDoc CCF.rpc.setClaimsDigest
16
+ */
17
+ export const setClaimsDigest = ccf.rpc.setClaimsDigest.bind(ccf.rpc);
package/global.d.ts CHANGED
@@ -194,6 +194,13 @@ export interface CCFRpc {
194
194
  * The default is `false`.
195
195
  */
196
196
  setApplyWrites(force: boolean): void;
197
+ /**
198
+ * Set a claims digest to be associated with the transaction if it succeeds. This
199
+ * digest can later be accessed from the receipt, and expanded into a full claim.
200
+ *
201
+ * The `digest` argument must be a sha-256 ArrayBuffer, eg. produced by {@link CCF.digest}
202
+ */
203
+ setClaimsDigest(digest: ArrayBuffer): void;
197
204
  }
198
205
  export interface CCFConsensus {
199
206
  /**
@@ -202,9 +209,24 @@ export interface CCFConsensus {
202
209
  getLastCommittedTxId(): TransactionId;
203
210
  /**
204
211
  * Get the status of a transaction by ID, provided as a view+seqno pair.
205
- * This is a node-local property - while it will converge on all nodes in
206
- * a healthy network, it is derived from distributed state rather than
207
- * distributed itself.
212
+ *
213
+ * Note that this value is the node's local understanding of the status
214
+ * of that transaction in the network at call time. For a given TxID, the
215
+ * initial status is always UNKNOWN, and eventually becomes COMMITTED or
216
+ * INVALID. See the documentation section titled "Verifying Transactions"
217
+ * for more detail.
218
+ *
219
+ * UNKNOWN [Initial status]
220
+ * v ^
221
+ * PENDING
222
+ * v v
223
+ * COMMITTED INVALID [Final statuses]
224
+ *
225
+ * This status is not sampled atomically per handler: if this is called
226
+ * multiple times in a transaction handler, later calls may see more up to
227
+ * date values than earlier calls. Once a final state (COMMITTED or INVALID)
228
+ * has been reached, no further changes are possible.
229
+ *
208
230
  */
209
231
  getStatusForTxId(view: number, seqno: number): TransactionStatus;
210
232
  /**
@@ -224,7 +246,7 @@ export interface CCFHistorical {
224
246
  * to completely fetch and validate. The call should be repeated later with
225
247
  * the same arguments to retrieve the requested entries. This state is kept
226
248
  * until it is deleted for one of the following reasons:
227
- * - A call to {@linkcode dropCachedStateRange}
249
+ * - A call to {@linkcode dropCachedStates}
228
250
  * - `seconds_until_expiry` seconds elapse without calling this function
229
251
  * - This handle is used to request a different seqno or range
230
252
  *
package/historical.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare const historicalState: import("./global.js").HistoricalState | un
7
7
  */
8
8
  export declare const getStateRange: (handle: number, startSeqno: number, endSeqno: number, secondsUntilExpiry: number) => import("./global.js").HistoricalState[] | null;
9
9
  /**
10
- * @inheritDoc CCFHistorical.dropCachedStateRange
10
+ * @inheritDoc CCFHistorical.dropCachedStates
11
11
  */
12
12
  export declare const dropCachedStates: (handle: number) => boolean;
13
13
  export { HistoricalState, Receipt, Proof, ProofElement } from "./global";
package/historical.js CHANGED
@@ -35,8 +35,8 @@ export const historicalState = ccf.historicalState;
35
35
  /**
36
36
  * @inheritDoc CCFHistorical.getStateRange
37
37
  */
38
- export const getStateRange = ccf.historical.getStateRange;
38
+ export const getStateRange = ccf.historical.getStateRange.bind(ccf.historical);
39
39
  /**
40
- * @inheritDoc CCFHistorical.dropCachedStateRange
40
+ * @inheritDoc CCFHistorical.dropCachedStates
41
41
  */
42
- export const dropCachedStates = ccf.historical.dropCachedStates;
42
+ export const dropCachedStates = ccf.historical.dropCachedStates.bind(ccf.historical);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/ccf-app",
3
- "version": "2.0.0-dev5",
3
+ "version": "2.0.0-rc0",
4
4
  "description": "CCF app support package",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -13,23 +13,22 @@
13
13
  "build": "tsc",
14
14
  "test": "cross-env TS_NODE_PROJECT=test/tsconfig.json mocha --loader=ts-node/esm test/**/*.test.ts",
15
15
  "docs": "typedoc",
16
- "docs:serve": "rm -rf html && concurrently \"typedoc --watch --preserveWatchOutput\" \"serve html\""
16
+ "docs:watch": "rm -rf html && typedoc --watch --preserveWatchOutput"
17
17
  },
18
18
  "author": "Microsoft",
19
19
  "license": "Apache-2.0",
20
20
  "devDependencies": {
21
21
  "@types/chai": "^4.2.15",
22
- "@types/mocha": "^8.2.2",
23
- "@types/node": "14.17.27",
24
- "@types/node-forge": "^0.9.7",
22
+ "@types/mocha": "^9.0.0",
23
+ "@types/node": "^17.0.8",
24
+ "@types/node-forge": "^1.0.0",
25
25
  "chai": "^4.3.4",
26
- "concurrently": "^6.0.0",
26
+ "colors": "1.4.0",
27
27
  "cross-env": "^7.0.3",
28
- "mocha": "^8.3.2",
29
- "node-forge": "^0.10.0",
30
- "serve": "^11.3.2",
31
- "ts-node": "^9.1.1",
32
- "typedoc": "^0.20.34",
33
- "typescript": "4.2.4"
28
+ "mocha": "^9.1.3",
29
+ "node-forge": "^1.2.0",
30
+ "ts-node": "^10.4.0",
31
+ "typedoc": "^0.22.7",
32
+ "typescript": "^4.2.4"
34
33
  }
35
34
  }
package/polyfill.js CHANGED
@@ -86,6 +86,9 @@ class CCFPolyfill {
86
86
  setApplyWrites(force) {
87
87
  throw new Error("Not implemented");
88
88
  },
89
+ setClaimsDigest(digest) {
90
+ throw new Error("Not implemented");
91
+ },
89
92
  };
90
93
  this.crypto = {
91
94
  verifySignature(algorithm, key, signature, data) {