@agoric/access-token 0.4.22 → 0.4.23-u23.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/package.json +8 -5
- package/src/access-token.js +4 -4
- package/src/json-store.js +8 -4
- package/.esmrc.json +0 -4
- package/CHANGELOG.md +0 -228
- package/test/state.test.js +0 -58
- package/test/token.test.js +0 -19
- package/tsconfig.json +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/access-token",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.23-u23.0",
|
|
4
4
|
"description": "Persistent credentials for Agoric users, backed by a simple JSON file",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/access-token.js",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"test:xs": "exit 0",
|
|
15
15
|
"lint": "yarn run -T run-s --continue-on-error 'lint:*'",
|
|
16
16
|
"lint-fix": "yarn lint:eslint --fix",
|
|
17
|
-
"lint:eslint": "
|
|
17
|
+
"lint:eslint": "node ../../scripts/eslint-repo.mjs .",
|
|
18
18
|
"lint:types": "yarn run -T tsc"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@agoric/internal": "0.
|
|
21
|
+
"@agoric/internal": "0.5.0-u23.0",
|
|
22
22
|
"n-readlines": "^1.0.0",
|
|
23
23
|
"proper-lockfile": "^4.1.2",
|
|
24
24
|
"tmp": "^0.2.1"
|
|
@@ -26,9 +26,12 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/n-readlines": "^1.0.3",
|
|
28
28
|
"@types/proper-lockfile": "^4.1.2",
|
|
29
|
-
"ava": "^
|
|
29
|
+
"ava": "^6.4.1",
|
|
30
30
|
"c8": "^10.1.3"
|
|
31
31
|
},
|
|
32
|
+
"files": [
|
|
33
|
+
"src"
|
|
34
|
+
],
|
|
32
35
|
"publishConfig": {
|
|
33
36
|
"access": "public"
|
|
34
37
|
},
|
|
@@ -47,5 +50,5 @@
|
|
|
47
50
|
"engines": {
|
|
48
51
|
"node": "^20.9 || ^22.11"
|
|
49
52
|
},
|
|
50
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "1147be15b0704de17204d04e2407fa3192b98a1c"
|
|
51
54
|
}
|
package/src/access-token.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import crypto from 'crypto';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import path from 'path';
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import crypto from 'node:crypto';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
5
|
|
|
6
6
|
import { openJSONStore } from './json-store.js';
|
|
7
7
|
|
package/src/json-store.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import process from 'process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import process from 'node:process';
|
|
5
5
|
import lockfile from 'proper-lockfile';
|
|
6
6
|
import Readlines from 'n-readlines';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @import {LockOptions} from 'proper-lockfile';
|
|
10
|
+
*/
|
|
11
|
+
|
|
8
12
|
// TODO: Update this when we make a breaking change.
|
|
9
13
|
// const DATA_FILE = 'data.jsonlines';
|
|
10
14
|
//
|
|
@@ -159,7 +163,7 @@ function makeStorageInMemory() {
|
|
|
159
163
|
* @param {string} [dirPath] Path to a directory in which database files may be kept, or
|
|
160
164
|
* null.
|
|
161
165
|
* @param {boolean} [forceReset] If true, initialize the database to an empty state
|
|
162
|
-
* @param {null |
|
|
166
|
+
* @param {null | LockOptions['retries']} [lockRetries] If null, do not lock the database.
|
|
163
167
|
*
|
|
164
168
|
* @returns {Promise<{
|
|
165
169
|
* storage: JSONStore, // a storage API object to load and store data
|
package/.esmrc.json
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,228 +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.4.22](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.22-u22.2...@agoric/access-token@0.4.22) (2026-04-02)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
9
|
-
|
|
10
|
-
## [0.4.22-u22.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.22-u22.1...@agoric/access-token@0.4.22-u22.2) (2025-09-09)
|
|
11
|
-
|
|
12
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
13
|
-
|
|
14
|
-
## [0.4.22-u22.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.22-u22.0...@agoric/access-token@0.4.22-u22.1) (2025-09-09)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
17
|
-
|
|
18
|
-
## [0.4.22-u22.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.21...@agoric/access-token@0.4.22-u22.0) (2025-09-08)
|
|
19
|
-
|
|
20
|
-
### Bug Fixes
|
|
21
|
-
|
|
22
|
-
* **access-token:** lock the jsonlines database ([7832114](https://github.com/Agoric/agoric-sdk/commit/78321142c0f816816bd788ba8a691c1ec9d6f5c5))
|
|
23
|
-
|
|
24
|
-
### [0.4.21](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.20...@agoric/access-token@0.4.21) (2023-05-19)
|
|
25
|
-
|
|
26
|
-
### Bug Fixes
|
|
27
|
-
|
|
28
|
-
* **agoric-cli:** begin separation of deploy host and script ([b091cad](https://github.com/Agoric/agoric-sdk/commit/b091cadbc652128e34d6225b6875baa5f1a9a4c7))
|
|
29
|
-
|
|
30
|
-
### [0.4.20](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.19...@agoric/access-token@0.4.20) (2022-10-05)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
33
|
-
|
|
34
|
-
### [0.4.19](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.18...@agoric/access-token@0.4.19) (2022-09-20)
|
|
35
|
-
|
|
36
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
37
|
-
|
|
38
|
-
### [0.4.18](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.17...@agoric/access-token@0.4.18) (2022-04-18)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
41
|
-
|
|
42
|
-
### [0.4.17](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.16...@agoric/access-token@0.4.17) (2022-02-21)
|
|
43
|
-
|
|
44
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
45
|
-
|
|
46
|
-
### [0.4.16](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.15...@agoric/access-token@0.4.16) (2021-12-02)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
49
|
-
|
|
50
|
-
### [0.4.15](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.14...@agoric/access-token@0.4.15) (2021-10-13)
|
|
51
|
-
|
|
52
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
53
|
-
|
|
54
|
-
### [0.4.14](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.13...@agoric/access-token@0.4.14) (2021-09-23)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
57
|
-
|
|
58
|
-
### [0.4.13](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.12...@agoric/access-token@0.4.13) (2021-09-15)
|
|
59
|
-
|
|
60
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
61
|
-
|
|
62
|
-
### [0.4.12](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.11...@agoric/access-token@0.4.12) (2021-08-18)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
65
|
-
|
|
66
|
-
### [0.4.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.10...@agoric/access-token@0.4.11) (2021-08-17)
|
|
67
|
-
|
|
68
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
69
|
-
|
|
70
|
-
### [0.4.10](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.7...@agoric/access-token@0.4.10) (2021-08-15)
|
|
71
|
-
|
|
72
|
-
### 0.26.10 (2021-07-28)
|
|
73
|
-
|
|
74
|
-
### Bug Fixes
|
|
75
|
-
|
|
76
|
-
* **access-token:** avoid clobbering temporary json-store files ([d468531](https://github.com/Agoric/agoric-sdk/commit/d46853146d2f1b51bd752ef280ce51cf227cdab0))
|
|
77
|
-
|
|
78
|
-
### [0.4.9](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.7...@agoric/access-token@0.4.9) (2021-08-14)
|
|
79
|
-
|
|
80
|
-
### 0.26.10 (2021-07-28)
|
|
81
|
-
|
|
82
|
-
### Bug Fixes
|
|
83
|
-
|
|
84
|
-
* **access-token:** avoid clobbering temporary json-store files ([d468531](https://github.com/Agoric/agoric-sdk/commit/d46853146d2f1b51bd752ef280ce51cf227cdab0))
|
|
85
|
-
|
|
86
|
-
### [0.4.8](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.7...@agoric/access-token@0.4.8) (2021-07-28)
|
|
87
|
-
|
|
88
|
-
### Bug Fixes
|
|
89
|
-
|
|
90
|
-
* **access-token:** avoid clobbering temporary json-store files ([d468531](https://github.com/Agoric/agoric-sdk/commit/d46853146d2f1b51bd752ef280ce51cf227cdab0))
|
|
91
|
-
|
|
92
|
-
### [0.4.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.6...@agoric/access-token@0.4.7) (2021-07-01)
|
|
93
|
-
|
|
94
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
95
|
-
|
|
96
|
-
### [0.4.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.5...@agoric/access-token@0.4.6) (2021-06-28)
|
|
97
|
-
|
|
98
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
99
|
-
|
|
100
|
-
### [0.4.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.4...@agoric/access-token@0.4.5) (2021-06-25)
|
|
101
|
-
|
|
102
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
103
|
-
|
|
104
|
-
### [0.4.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.3...@agoric/access-token@0.4.4) (2021-06-24)
|
|
105
|
-
|
|
106
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
107
|
-
|
|
108
|
-
### [0.4.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.2...@agoric/access-token@0.4.3) (2021-06-23)
|
|
109
|
-
|
|
110
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
111
|
-
|
|
112
|
-
### [0.4.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.1...@agoric/access-token@0.4.2) (2021-06-16)
|
|
113
|
-
|
|
114
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
115
|
-
|
|
116
|
-
### 0.4.1 (2021-06-15)
|
|
117
|
-
|
|
118
|
-
### Features
|
|
119
|
-
|
|
120
|
-
* new access-token package for encapsulation from swing-store ([aa52d2e](https://github.com/Agoric/agoric-sdk/commit/aa52d2ea54ec679889db9abdb8cdd6639824f50e))
|
|
121
|
-
|
|
122
|
-
### Bug Fixes
|
|
123
|
-
|
|
124
|
-
* Pin ESM to forked version ([54dbb55](https://github.com/Agoric/agoric-sdk/commit/54dbb55d64d7ff7adb395bc4bd9d1461dd2d3c17))
|
|
125
|
-
|
|
126
|
-
## [0.3.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.3.5...@agoric/swing-store-simple@0.3.6) (2021-04-07)
|
|
127
|
-
|
|
128
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
129
|
-
|
|
130
|
-
## [0.3.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.3.4...@agoric/swing-store-simple@0.3.5) (2021-04-06)
|
|
131
|
-
|
|
132
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
133
|
-
|
|
134
|
-
## [0.3.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.3.3...@agoric/swing-store-simple@0.3.4) (2021-03-24)
|
|
135
|
-
|
|
136
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
137
|
-
|
|
138
|
-
## [0.3.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.3.2...@agoric/swing-store-simple@0.3.3) (2021-03-16)
|
|
139
|
-
|
|
140
|
-
### Bug Fixes
|
|
141
|
-
|
|
142
|
-
* make separate 'test:xs' target, remove XS from 'test' target ([b9c1a69](https://github.com/Agoric/agoric-sdk/commit/b9c1a6987093fc8e09e8aba7acd2a1618413bac8)), closes [#2647](https://github.com/Agoric/agoric-sdk/issues/2647)
|
|
143
|
-
|
|
144
|
-
## [0.3.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.3.1...@agoric/swing-store-simple@0.3.2) (2021-02-22)
|
|
145
|
-
|
|
146
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
147
|
-
|
|
148
|
-
## [0.3.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.3.0...@agoric/swing-store-simple@0.3.1) (2021-02-16)
|
|
149
|
-
|
|
150
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
151
|
-
|
|
152
|
-
# [0.3.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.7...@agoric/swing-store-simple@0.3.0) (2020-12-10)
|
|
153
|
-
|
|
154
|
-
### Features
|
|
155
|
-
|
|
156
|
-
* **import-bundle:** Preliminary support Endo zip hex bundle format ([#1983](https://github.com/Agoric/agoric-sdk/issues/1983)) ([983681b](https://github.com/Agoric/agoric-sdk/commit/983681bfc4bf512b6bd90806ed9220cd4fefc13c))
|
|
157
|
-
|
|
158
|
-
## [0.2.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.7-dev.0...@agoric/swing-store-simple@0.2.7) (2020-11-07)
|
|
159
|
-
|
|
160
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
161
|
-
|
|
162
|
-
## [0.2.7-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.6...@agoric/swing-store-simple@0.2.7-dev.0) (2020-10-19)
|
|
163
|
-
|
|
164
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
165
|
-
|
|
166
|
-
## [0.2.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.6-dev.2...@agoric/swing-store-simple@0.2.6) (2020-10-11)
|
|
167
|
-
|
|
168
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
169
|
-
|
|
170
|
-
## [0.2.6-dev.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.6-dev.1...@agoric/swing-store-simple@0.2.6-dev.2) (2020-09-18)
|
|
171
|
-
|
|
172
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
173
|
-
|
|
174
|
-
## [0.2.6-dev.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.6-dev.0...@agoric/swing-store-simple@0.2.6-dev.1) (2020-09-18)
|
|
175
|
-
|
|
176
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
177
|
-
|
|
178
|
-
## [0.2.6-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.5...@agoric/swing-store-simple@0.2.6-dev.0) (2020-09-18)
|
|
179
|
-
|
|
180
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
181
|
-
|
|
182
|
-
## [0.2.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.4...@agoric/swing-store-simple@0.2.5) (2020-09-16)
|
|
183
|
-
|
|
184
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
185
|
-
|
|
186
|
-
## [0.2.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.3...@agoric/swing-store-simple@0.2.4) (2020-08-31)
|
|
187
|
-
|
|
188
|
-
### Bug Fixes
|
|
189
|
-
|
|
190
|
-
* reduce inconsistency among our linting rules ([#1492](https://github.com/Agoric/agoric-sdk/issues/1492)) ([b6b675e](https://github.com/Agoric/agoric-sdk/commit/b6b675e2de110e2af19cad784a66220cab21dacf))
|
|
191
|
-
|
|
192
|
-
## [0.2.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.2...@agoric/swing-store-simple@0.2.3) (2020-06-30)
|
|
193
|
-
|
|
194
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
195
|
-
|
|
196
|
-
## [0.2.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.1...@agoric/swing-store-simple@0.2.2) (2020-05-17)
|
|
197
|
-
|
|
198
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
199
|
-
|
|
200
|
-
## [0.2.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.0...@agoric/swing-store-simple@0.2.1) (2020-05-10)
|
|
201
|
-
|
|
202
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
203
|
-
|
|
204
|
-
# [0.2.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.1.2...@agoric/swing-store-simple@0.2.0) (2020-05-04)
|
|
205
|
-
|
|
206
|
-
### Features
|
|
207
|
-
|
|
208
|
-
* swing-store-simple: add isSwingStore() query ([c450459](https://github.com/Agoric/agoric-sdk/commit/c450459a92d3ecba4a106820d980683babdf8c29)), closes [#953](https://github.com/Agoric/agoric-sdk/issues/953)
|
|
209
|
-
|
|
210
|
-
## [0.1.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.1.2-alpha.0...@agoric/swing-store-simple@0.1.2) (2020-04-13)
|
|
211
|
-
|
|
212
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
213
|
-
|
|
214
|
-
## [0.1.2-alpha.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.1.1...@agoric/swing-store-simple@0.1.2-alpha.0) (2020-04-12)
|
|
215
|
-
|
|
216
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
217
|
-
|
|
218
|
-
## [0.1.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.1.1-alpha.0...@agoric/swing-store-simple@0.1.1) (2020-04-02)
|
|
219
|
-
|
|
220
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
221
|
-
|
|
222
|
-
## 0.1.1-alpha.0 (2020-04-02)
|
|
223
|
-
|
|
224
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
|
225
|
-
|
|
226
|
-
## 0.1.1-alpha.0 (2020-04-02)
|
|
227
|
-
|
|
228
|
-
**Note:** Version bump only for package @agoric/swing-store-simple
|
package/test/state.test.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import tmp from 'tmp';
|
|
3
|
-
import { makeTempDirFactory } from '@agoric/internal/src/tmpDir.js';
|
|
4
|
-
import {
|
|
5
|
-
initJSONStore,
|
|
6
|
-
openJSONStore,
|
|
7
|
-
getAllState,
|
|
8
|
-
isJSONStore,
|
|
9
|
-
} from '../src/json-store.js';
|
|
10
|
-
|
|
11
|
-
const tmpDir = makeTempDirFactory(tmp);
|
|
12
|
-
|
|
13
|
-
function testStorage(t, storage) {
|
|
14
|
-
t.falsy(storage.has('missing'));
|
|
15
|
-
t.is(storage.get('missing'), undefined);
|
|
16
|
-
|
|
17
|
-
storage.set('foo', 'f');
|
|
18
|
-
t.truthy(storage.has('foo'));
|
|
19
|
-
t.is(storage.get('foo'), 'f');
|
|
20
|
-
|
|
21
|
-
storage.set('foo2', 'f2');
|
|
22
|
-
storage.set('foo1', 'f1');
|
|
23
|
-
storage.set('foo3', 'f3');
|
|
24
|
-
t.deepEqual(Array.from(storage.getKeys('foo1', 'foo3')), ['foo1', 'foo2']);
|
|
25
|
-
t.deepEqual(Array.from(storage.getKeys('foo1', 'foo4')), [
|
|
26
|
-
'foo1',
|
|
27
|
-
'foo2',
|
|
28
|
-
'foo3',
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
storage.delete('foo2');
|
|
32
|
-
t.falsy(storage.has('foo2'));
|
|
33
|
-
t.is(storage.get('foo2'), undefined);
|
|
34
|
-
t.deepEqual(Array.from(storage.getKeys('foo1', 'foo4')), ['foo1', 'foo3']);
|
|
35
|
-
|
|
36
|
-
const reference = {
|
|
37
|
-
foo: 'f',
|
|
38
|
-
foo1: 'f1',
|
|
39
|
-
foo3: 'f3',
|
|
40
|
-
};
|
|
41
|
-
t.deepEqual(getAllState(storage), reference, 'check state after changes');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
test('storageInFile', async t => {
|
|
45
|
-
const [dbDir, cleanup] = tmpDir('testdb');
|
|
46
|
-
t.teardown(cleanup);
|
|
47
|
-
t.is(isJSONStore(dbDir), false);
|
|
48
|
-
const { storage, commit, close } = await initJSONStore(dbDir);
|
|
49
|
-
testStorage(t, storage);
|
|
50
|
-
await commit();
|
|
51
|
-
const before = getAllState(storage);
|
|
52
|
-
await close();
|
|
53
|
-
t.is(isJSONStore(dbDir), true);
|
|
54
|
-
|
|
55
|
-
const { storage: after } = await openJSONStore(dbDir);
|
|
56
|
-
t.deepEqual(getAllState(after), before, 'check state after reread');
|
|
57
|
-
t.is(isJSONStore(dbDir), true);
|
|
58
|
-
});
|
package/test/token.test.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import tmp from 'tmp';
|
|
3
|
-
import { makeTempDirFactory } from '@agoric/internal/src/tmpDir.js';
|
|
4
|
-
import { getAccessToken } from '../src/access-token.js';
|
|
5
|
-
|
|
6
|
-
const tmpDir = makeTempDirFactory(tmp);
|
|
7
|
-
|
|
8
|
-
test('access tokens', async t => {
|
|
9
|
-
const [sharedStateDir, removeCallback] = tmpDir('access-token-test');
|
|
10
|
-
const [a, b, c] = await Promise.all([
|
|
11
|
-
getAccessToken(1234, sharedStateDir),
|
|
12
|
-
getAccessToken(1234, sharedStateDir),
|
|
13
|
-
getAccessToken(1234, sharedStateDir),
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
t.is(a, b);
|
|
17
|
-
t.is(a, c);
|
|
18
|
-
await removeCallback();
|
|
19
|
-
});
|
package/tsconfig.json
DELETED