@agoric/access-token 0.4.22-other-dev-d15096d.0.d15096d → 0.4.22-other-dev-ecf44df.0.ecf44df

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/access-token",
3
- "version": "0.4.22-other-dev-d15096d.0.d15096d",
3
+ "version": "0.4.22-other-dev-ecf44df.0.ecf44df",
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,38 +14,30 @@
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": "yarn run -T eslint .",
18
- "lint:types": "yarn run -T tsc"
17
+ "lint:eslint": "node ../../scripts/eslint-repo.mjs .",
18
+ "lint:types": "yarn run -T tsgo --tsBuildInfoFile tsconfig.tsgo.tsbuildinfo"
19
19
  },
20
20
  "dependencies": {
21
- "@agoric/internal": "0.3.3-other-dev-d15096d.0.d15096d",
22
- "n-readlines": "^1.0.0",
21
+ "@agoric/internal": "0.3.3-other-dev-ecf44df.0.ecf44df",
23
22
  "proper-lockfile": "^4.1.2",
24
23
  "tmp": "^0.2.1"
25
24
  },
26
25
  "devDependencies": {
27
- "@types/n-readlines": "^1.0.3",
28
26
  "@types/proper-lockfile": "^4.1.2",
29
- "ava": "^5.3.0",
27
+ "ava": "^8.0.1",
30
28
  "c8": "^10.1.3"
31
29
  },
30
+ "files": [
31
+ "src"
32
+ ],
32
33
  "publishConfig": {
33
34
  "access": "public"
34
35
  },
35
- "ava": {
36
- "files": [
37
- "test/**/*.test.*"
38
- ],
39
- "require": [
40
- "@endo/init/debug.js"
41
- ],
42
- "timeout": "2m"
43
- },
44
36
  "typeCoverage": {
45
- "atLeast": 83.57
37
+ "atLeast": 84.05
46
38
  },
47
39
  "engines": {
48
- "node": "^20.9 || ^22.11"
40
+ "node": "^22.11 || ^24.14"
49
41
  },
50
- "gitHead": "d15096dc4ff8b96e9b6cd11954c20d3a9efbb393"
42
+ "gitHead": "ecf44df5eadcc7a1d68745f056fca19155fb5231"
51
43
  }
@@ -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,9 +1,9 @@
1
1
  // @ts-check
2
- import fs from 'fs';
3
- import path from 'path';
4
- import process from 'process';
2
+ import fs, { createReadStream } from 'node:fs';
3
+ import path from 'node:path';
4
+ import process from 'node:process';
5
+ import { createInterface } from 'node:readline';
5
6
  import lockfile from 'proper-lockfile';
6
- import Readlines from 'n-readlines';
7
7
 
8
8
  /**
9
9
  * @import {LockOptions} from 'proper-lockfile';
@@ -197,9 +197,20 @@ async function makeJSONStore(
197
197
  if (forceReset) {
198
198
  safeUnlink(storeFile);
199
199
  } else {
200
- let lines;
201
200
  try {
202
- lines = new Readlines(storeFile);
201
+ // Read file line by line using node:readline (replacement for .split('\n'))
202
+ const fileStream = createReadStream(storeFile);
203
+ const rl = createInterface({
204
+ input: fileStream,
205
+ crlfDelay: Infinity,
206
+ });
207
+
208
+ for await (const line of rl) {
209
+ if (line.trim()) {
210
+ const [key, value] = JSON.parse(line);
211
+ storage.set(key, value);
212
+ }
213
+ }
203
214
  } catch (e) {
204
215
  // storeFile will be missing the first time we try to use it. That's OK;
205
216
  // commit will create it.
@@ -207,14 +218,6 @@ async function makeJSONStore(
207
218
  throw e;
208
219
  }
209
220
  }
210
- if (lines) {
211
- let line = lines.next();
212
- while (line) {
213
- const [key, value] = JSON.parse(line.toString());
214
- storage.set(key, value);
215
- line = lines.next();
216
- }
217
- }
218
221
  }
219
222
  }
220
223
 
package/.esmrc.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "cache": true,
3
- "sourceMap": true
4
- }
package/CHANGELOG.md DELETED
@@ -1,386 +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.21](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.20...@agoric/access-token@0.4.21) (2023-05-19)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * **agoric-cli:** begin separation of deploy host and script ([b091cad](https://github.com/Agoric/agoric-sdk/commit/b091cadbc652128e34d6225b6875baa5f1a9a4c7))
12
-
13
-
14
-
15
- ### [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)
16
-
17
- **Note:** Version bump only for package @agoric/access-token
18
-
19
-
20
-
21
-
22
-
23
- ### [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)
24
-
25
- **Note:** Version bump only for package @agoric/access-token
26
-
27
-
28
-
29
-
30
-
31
- ### [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)
32
-
33
- **Note:** Version bump only for package @agoric/access-token
34
-
35
-
36
-
37
-
38
-
39
- ### [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)
40
-
41
- **Note:** Version bump only for package @agoric/access-token
42
-
43
-
44
-
45
-
46
-
47
- ### [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)
48
-
49
- **Note:** Version bump only for package @agoric/access-token
50
-
51
-
52
-
53
-
54
-
55
- ### [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)
56
-
57
- **Note:** Version bump only for package @agoric/access-token
58
-
59
-
60
-
61
-
62
-
63
- ### [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)
64
-
65
- **Note:** Version bump only for package @agoric/access-token
66
-
67
-
68
-
69
-
70
-
71
- ### [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)
72
-
73
- **Note:** Version bump only for package @agoric/access-token
74
-
75
-
76
-
77
-
78
-
79
- ### [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)
80
-
81
- **Note:** Version bump only for package @agoric/access-token
82
-
83
-
84
-
85
-
86
-
87
- ### [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)
88
-
89
- **Note:** Version bump only for package @agoric/access-token
90
-
91
-
92
-
93
-
94
-
95
- ### [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)
96
-
97
- ### 0.26.10 (2021-07-28)
98
-
99
-
100
- ### Bug Fixes
101
-
102
- * **access-token:** avoid clobbering temporary json-store files ([d468531](https://github.com/Agoric/agoric-sdk/commit/d46853146d2f1b51bd752ef280ce51cf227cdab0))
103
-
104
-
105
-
106
- ### [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)
107
-
108
- ### 0.26.10 (2021-07-28)
109
-
110
-
111
- ### Bug Fixes
112
-
113
- * **access-token:** avoid clobbering temporary json-store files ([d468531](https://github.com/Agoric/agoric-sdk/commit/d46853146d2f1b51bd752ef280ce51cf227cdab0))
114
-
115
-
116
-
117
- ### [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)
118
-
119
-
120
- ### Bug Fixes
121
-
122
- * **access-token:** avoid clobbering temporary json-store files ([d468531](https://github.com/Agoric/agoric-sdk/commit/d46853146d2f1b51bd752ef280ce51cf227cdab0))
123
-
124
-
125
-
126
- ### [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)
127
-
128
- **Note:** Version bump only for package @agoric/access-token
129
-
130
-
131
-
132
-
133
-
134
- ### [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)
135
-
136
- **Note:** Version bump only for package @agoric/access-token
137
-
138
-
139
-
140
-
141
-
142
- ### [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)
143
-
144
- **Note:** Version bump only for package @agoric/access-token
145
-
146
-
147
-
148
-
149
-
150
- ### [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)
151
-
152
- **Note:** Version bump only for package @agoric/access-token
153
-
154
-
155
-
156
-
157
-
158
- ### [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)
159
-
160
- **Note:** Version bump only for package @agoric/access-token
161
-
162
-
163
-
164
-
165
-
166
- ### [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)
167
-
168
- **Note:** Version bump only for package @agoric/access-token
169
-
170
-
171
-
172
-
173
-
174
- ### 0.4.1 (2021-06-15)
175
-
176
-
177
- ### Features
178
-
179
- * new access-token package for encapsulation from swing-store ([aa52d2e](https://github.com/Agoric/agoric-sdk/commit/aa52d2ea54ec679889db9abdb8cdd6639824f50e))
180
-
181
-
182
- ### Bug Fixes
183
-
184
- * Pin ESM to forked version ([54dbb55](https://github.com/Agoric/agoric-sdk/commit/54dbb55d64d7ff7adb395bc4bd9d1461dd2d3c17))
185
-
186
-
187
-
188
- ## [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)
189
-
190
- **Note:** Version bump only for package @agoric/swing-store-simple
191
-
192
-
193
-
194
-
195
-
196
- ## [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)
197
-
198
- **Note:** Version bump only for package @agoric/swing-store-simple
199
-
200
-
201
-
202
-
203
-
204
- ## [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)
205
-
206
- **Note:** Version bump only for package @agoric/swing-store-simple
207
-
208
-
209
-
210
-
211
-
212
- ## [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)
213
-
214
-
215
- ### Bug Fixes
216
-
217
- * 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)
218
-
219
-
220
-
221
-
222
-
223
- ## [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)
224
-
225
- **Note:** Version bump only for package @agoric/swing-store-simple
226
-
227
-
228
-
229
-
230
-
231
- ## [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)
232
-
233
- **Note:** Version bump only for package @agoric/swing-store-simple
234
-
235
-
236
-
237
-
238
-
239
- # [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)
240
-
241
-
242
- ### Features
243
-
244
- * **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))
245
-
246
-
247
-
248
-
249
-
250
- ## [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)
251
-
252
- **Note:** Version bump only for package @agoric/swing-store-simple
253
-
254
-
255
-
256
-
257
-
258
- ## [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)
259
-
260
- **Note:** Version bump only for package @agoric/swing-store-simple
261
-
262
-
263
-
264
-
265
-
266
- ## [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)
267
-
268
- **Note:** Version bump only for package @agoric/swing-store-simple
269
-
270
-
271
-
272
-
273
-
274
- ## [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)
275
-
276
- **Note:** Version bump only for package @agoric/swing-store-simple
277
-
278
-
279
-
280
-
281
-
282
- ## [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)
283
-
284
- **Note:** Version bump only for package @agoric/swing-store-simple
285
-
286
-
287
-
288
-
289
-
290
- ## [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)
291
-
292
- **Note:** Version bump only for package @agoric/swing-store-simple
293
-
294
-
295
-
296
-
297
-
298
- ## [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)
299
-
300
- **Note:** Version bump only for package @agoric/swing-store-simple
301
-
302
-
303
-
304
-
305
-
306
- ## [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)
307
-
308
-
309
- ### Bug Fixes
310
-
311
- * reduce inconsistency among our linting rules ([#1492](https://github.com/Agoric/agoric-sdk/issues/1492)) ([b6b675e](https://github.com/Agoric/agoric-sdk/commit/b6b675e2de110e2af19cad784a66220cab21dacf))
312
-
313
-
314
-
315
-
316
-
317
- ## [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)
318
-
319
- **Note:** Version bump only for package @agoric/swing-store-simple
320
-
321
-
322
-
323
-
324
-
325
- ## [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)
326
-
327
- **Note:** Version bump only for package @agoric/swing-store-simple
328
-
329
-
330
-
331
-
332
-
333
- ## [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)
334
-
335
- **Note:** Version bump only for package @agoric/swing-store-simple
336
-
337
-
338
-
339
-
340
-
341
- # [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)
342
-
343
-
344
- ### Features
345
-
346
- * 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)
347
-
348
-
349
-
350
-
351
-
352
- ## [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)
353
-
354
- **Note:** Version bump only for package @agoric/swing-store-simple
355
-
356
-
357
-
358
-
359
-
360
- ## [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)
361
-
362
- **Note:** Version bump only for package @agoric/swing-store-simple
363
-
364
-
365
-
366
-
367
-
368
- ## [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)
369
-
370
- **Note:** Version bump only for package @agoric/swing-store-simple
371
-
372
-
373
-
374
-
375
-
376
- ## 0.1.1-alpha.0 (2020-04-02)
377
-
378
- **Note:** Version bump only for package @agoric/swing-store-simple
379
-
380
-
381
-
382
-
383
-
384
- ## 0.1.1-alpha.0 (2020-04-02)
385
-
386
- **Note:** Version bump only for package @agoric/swing-store-simple
@@ -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
- });
@@ -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
@@ -1,11 +0,0 @@
1
- // This file can contain .js-specific Typescript compiler config.
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "allowSyntheticDefaultImports": true
6
- },
7
- "include": [
8
- "src/**/*.js",
9
- "test/**/*.js"
10
- ]
11
- }