@agoric/time 0.3.3-mainnet1B-dev-b0c1f78.0 → 0.3.3-orchestration-dev-096c4e8.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.
- package/index.js +2 -0
- package/package.json +18 -9
- package/src/timeMath.js +19 -28
- package/src/typeGuards.js +1 -1
- package/src/types.d.ts +1 -1
- package/src/types.js +2 -0
- package/CHANGELOG.md +0 -69
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/time",
|
|
3
|
-
"version": "0.3.3-
|
|
3
|
+
"version": "0.3.3-orchestration-dev-096c4e8.0+096c4e8",
|
|
4
4
|
"description": "Timestamps, time math, timer service API definition",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
|
+
"types": "index.js",
|
|
7
8
|
"engines": {
|
|
8
9
|
"node": ">=14.15.0"
|
|
9
10
|
},
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
"test": "ava",
|
|
13
14
|
"test:xs": "exit 0",
|
|
14
15
|
"lint": "run-s --continue-on-error lint:*",
|
|
15
|
-
"lint:types": "tsc
|
|
16
|
+
"lint:types": "tsc",
|
|
16
17
|
"lint:eslint": "eslint .",
|
|
17
18
|
"lint-fix": "yarn lint:eslint --fix"
|
|
18
19
|
},
|
|
@@ -30,14 +31,19 @@
|
|
|
30
31
|
},
|
|
31
32
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@agoric/assert": "0.6.1-
|
|
34
|
-
"@
|
|
35
|
-
"@endo/
|
|
34
|
+
"@agoric/assert": "0.6.1-orchestration-dev-096c4e8.0+096c4e8",
|
|
35
|
+
"@endo/nat": "^5.0.4",
|
|
36
|
+
"@endo/patterns": "^1.2.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@endo/far": "0.
|
|
39
|
-
"@endo/init": "0.
|
|
40
|
-
"ava": "^5.
|
|
39
|
+
"@endo/far": "^1.0.4",
|
|
40
|
+
"@endo/init": "^1.0.4",
|
|
41
|
+
"ava": "^5.3.0"
|
|
42
|
+
},
|
|
43
|
+
"ava": {
|
|
44
|
+
"require": [
|
|
45
|
+
"@endo/init/debug.js"
|
|
46
|
+
]
|
|
41
47
|
},
|
|
42
48
|
"files": [
|
|
43
49
|
"*.js",
|
|
@@ -47,5 +53,8 @@
|
|
|
47
53
|
"publishConfig": {
|
|
48
54
|
"access": "public"
|
|
49
55
|
},
|
|
50
|
-
"
|
|
56
|
+
"typeCoverage": {
|
|
57
|
+
"atLeast": 86.95
|
|
58
|
+
},
|
|
59
|
+
"gitHead": "096c4e8fce80e9a509b0e1a30fda11736c4570e1"
|
|
51
60
|
}
|
package/src/timeMath.js
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
import { mustMatch } from '@agoric/store';
|
|
2
1
|
import { Nat } from '@endo/nat';
|
|
2
|
+
import { mustMatch } from '@endo/patterns';
|
|
3
3
|
import { RelativeTimeRecordShape, TimestampRecordShape } from './typeGuards.js';
|
|
4
4
|
|
|
5
5
|
const { Fail, quote: q } = assert;
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {import('./types').TimerBrand} TimerBrand
|
|
8
|
-
* @typedef {import('./types').Timestamp} Timestamp
|
|
9
|
-
* @typedef {import('./types').RelativeTime} RelativeTime
|
|
10
|
-
* @typedef {import('./types').RelativeTimeValue} RelativeTimeValue
|
|
11
|
-
* @typedef {import('./types').TimestampValue} TimestampValue
|
|
12
|
-
* @typedef {import('./types').TimeMathType} TimeMathType
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
6
|
|
|
16
7
|
/**
|
|
17
8
|
* `agreedTimerBrand` is internal to this module.
|
|
18
9
|
*
|
|
19
|
-
* @param {TimerBrand | undefined} leftBrand
|
|
20
|
-
* @param {TimerBrand | undefined} rightBrand
|
|
21
|
-
* @returns {TimerBrand | undefined}
|
|
10
|
+
* @param {import('./types').TimerBrand | undefined} leftBrand
|
|
11
|
+
* @param {import('./types').TimerBrand | undefined} rightBrand
|
|
12
|
+
* @returns {import('./types').TimerBrand | undefined}
|
|
22
13
|
*/
|
|
23
14
|
const agreedTimerBrand = (leftBrand, rightBrand) => {
|
|
24
15
|
if (leftBrand === undefined) {
|
|
@@ -43,9 +34,9 @@ const agreedTimerBrand = (leftBrand, rightBrand) => {
|
|
|
43
34
|
* this logic. It does the error checking between the operands, and returns
|
|
44
35
|
* the brand, if any, that should label the resulting time value.
|
|
45
36
|
*
|
|
46
|
-
* @param {Timestamp | RelativeTime} left
|
|
47
|
-
* @param {Timestamp | RelativeTime} right
|
|
48
|
-
* @returns {TimerBrand | undefined}
|
|
37
|
+
* @param {import('./types').Timestamp | import('./types').RelativeTime} left
|
|
38
|
+
* @param {import('./types').Timestamp | import('./types').RelativeTime} right
|
|
39
|
+
* @returns {import('./types').TimerBrand | undefined}
|
|
49
40
|
*/
|
|
50
41
|
const sharedTimerBrand = (left, right) => {
|
|
51
42
|
const leftBrand = typeof left === 'bigint' ? undefined : left.timerBrand;
|
|
@@ -58,10 +49,10 @@ const sharedTimerBrand = (left, right) => {
|
|
|
58
49
|
* operators in the case where the returned time should be a `Timestamp`
|
|
59
50
|
* rather than a `RelativeTime`.
|
|
60
51
|
*
|
|
61
|
-
* @param {Timestamp | RelativeTime} left
|
|
62
|
-
* @param {Timestamp | RelativeTime} right
|
|
63
|
-
* @param {TimestampValue} absValue
|
|
64
|
-
* @returns {Timestamp}
|
|
52
|
+
* @param {import('./types').Timestamp | import('./types').RelativeTime} left
|
|
53
|
+
* @param {import('./types').Timestamp | import('./types').RelativeTime} right
|
|
54
|
+
* @param {import('./types').TimestampValue} absValue
|
|
55
|
+
* @returns {import('./types').Timestamp}
|
|
65
56
|
*/
|
|
66
57
|
const absLike = (left, right, absValue) => {
|
|
67
58
|
Nat(absValue);
|
|
@@ -81,10 +72,10 @@ const absLike = (left, right, absValue) => {
|
|
|
81
72
|
* operators in the case where the returned time should be a `RelativeTime`
|
|
82
73
|
* rather than a `Timestamp`.
|
|
83
74
|
*
|
|
84
|
-
* @param {Timestamp | RelativeTime} left
|
|
85
|
-
* @param {Timestamp | RelativeTime} right
|
|
86
|
-
* @param {RelativeTimeValue} relValue
|
|
87
|
-
* @returns {RelativeTime}
|
|
75
|
+
* @param {import('./types').Timestamp | import('./types').RelativeTime} left
|
|
76
|
+
* @param {import('./types').Timestamp | import('./types').RelativeTime} right
|
|
77
|
+
* @param {import('./types').RelativeTimeValue} relValue
|
|
78
|
+
* @returns {import('./types').RelativeTime}
|
|
88
79
|
*/
|
|
89
80
|
const relLike = (left, right, relValue) => {
|
|
90
81
|
Nat(relValue);
|
|
@@ -196,11 +187,11 @@ const modRelRel = (rel, step) =>
|
|
|
196
187
|
* `compareValues` is internal to this module, and used to implement
|
|
197
188
|
* the time comparison operators.
|
|
198
189
|
*
|
|
199
|
-
* @param {Timestamp | RelativeTime} left
|
|
200
|
-
* @param {Timestamp | RelativeTime} right
|
|
190
|
+
* @param {import('./types').Timestamp | import('./types').RelativeTime} left
|
|
191
|
+
* @param {import('./types').Timestamp | import('./types').RelativeTime} right
|
|
201
192
|
* @param {bigint} v1
|
|
202
193
|
* @param {bigint} v2
|
|
203
|
-
* @returns {RankComparison}
|
|
194
|
+
* @returns {import('@endo/marshal').RankComparison}
|
|
204
195
|
*/
|
|
205
196
|
const compareValues = (left, right, v1, v2) => {
|
|
206
197
|
sharedTimerBrand(left, right);
|
|
@@ -246,7 +237,7 @@ const compareValues = (left, right, v1, v2) => {
|
|
|
246
237
|
* operand, and return a labeled time object with the brand of the labeled
|
|
247
238
|
* operand.
|
|
248
239
|
*
|
|
249
|
-
* @type {TimeMathType}
|
|
240
|
+
* @type {import('./types').TimeMathType}
|
|
250
241
|
*/
|
|
251
242
|
export const TimeMath = harden({
|
|
252
243
|
absValue,
|
package/src/typeGuards.js
CHANGED
package/src/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-use-before-define, no-undef */
|
|
2
2
|
import type { ERef } from '@endo/eventual-send';
|
|
3
3
|
|
|
4
|
-
import type { RankComparison } from '@
|
|
4
|
+
import type { RankComparison } from '@endo/marshal';
|
|
5
5
|
|
|
6
6
|
/// <reference types="@agoric/notifier/src/types.js"/>
|
|
7
7
|
|
package/src/types.js
ADDED
package/CHANGELOG.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
### [0.3.3-u13.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/time@0.3.3-u12.0...@agoric/time@0.3.3-u13.0) (2023-12-07)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @agoric/time
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### [0.3.3-u12.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/time@0.3.3-u11wf.0...@agoric/time@0.3.3-u12.0) (2023-11-10)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @agoric/time
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### [0.3.3-u11wf.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/time@0.3.3-u11.0...@agoric/time@0.3.3-u11wf.0) (2023-09-23)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @agoric/time
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### [0.3.3-u11.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/time@0.3.2...@agoric/time@0.3.3-u11.0) (2023-08-24)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @agoric/time
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### [0.3.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/time@0.3.1...@agoric/time@0.3.2) (2023-06-02)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @agoric/time
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### [0.3.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/time@0.3.0...@agoric/time@0.3.1) (2023-05-24)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @agoric/time
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## 0.3.0 (2023-05-19)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
### Features
|
|
58
|
-
|
|
59
|
-
* **auction:** add an auctioneer to manage vault liquidation ([#7000](https://github.com/Agoric/agoric-sdk/issues/7000)) ([398b70f](https://github.com/Agoric/agoric-sdk/commit/398b70f7e028f957afc1582f0ee31eb2574c94d0)), closes [#6992](https://github.com/Agoric/agoric-sdk/issues/6992) [#7047](https://github.com/Agoric/agoric-sdk/issues/7047) [#7074](https://github.com/Agoric/agoric-sdk/issues/7074)
|
|
60
|
-
* create new @agoric/time package ([a61a3fb](https://github.com/Agoric/agoric-sdk/commit/a61a3fbb7a5ccfe07c715a310baa88ada8e572b2)), closes [#6003](https://github.com/Agoric/agoric-sdk/issues/6003)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
### Bug Fixes
|
|
64
|
-
|
|
65
|
-
* **time:** TimerService now returns branded TimestampRecord ([9137e9c](https://github.com/Agoric/agoric-sdk/commit/9137e9cab6f459c876b1a2ad8e681be7224749ce)), closes [#6003](https://github.com/Agoric/agoric-sdk/issues/6003)
|
|
66
|
-
* clean up types ([6f53f19](https://github.com/Agoric/agoric-sdk/commit/6f53f1915ce21e65fefc2fff900b7d4b947be6b1))
|
|
67
|
-
* move timer files to new package ([c105bde](https://github.com/Agoric/agoric-sdk/commit/c105bdefff2527a90b3c6b9d80d0462944dd51c3))
|
|
68
|
-
* TimerBrand has isMyTimerService(), not isMyTimer() ([9f4e867](https://github.com/Agoric/agoric-sdk/commit/9f4e8670694504ebbd451c8840f900a1a24b902f))
|
|
69
|
-
* **time:** fix the code/test to work in its new home ([504d333](https://github.com/Agoric/agoric-sdk/commit/504d3335cf632cc50e079fb27a82db604318bd4a))
|