@moxxy/plugin-oauth 0.41.3 → 0.42.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 +5 -5
- package/src/ensure-fresh.test.ts +6 -5
- package/src/tools.test.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxxy/plugin-oauth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "Generic OAuth 2.0 + PKCE client. Loopback callback server, vault-backed token storage, refresh helpers. Bundled skills for Google Workspace + arbitrary providers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"moxxy",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"zod": "^3.25.76",
|
|
57
|
-
"@moxxy/sdk": "0.
|
|
58
|
-
"@moxxy/plugin-vault": "0.
|
|
57
|
+
"@moxxy/sdk": "0.42.0",
|
|
58
|
+
"@moxxy/plugin-vault": "0.42.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@types/node": "^22.
|
|
61
|
+
"@types/node": "^22.20.5",
|
|
62
62
|
"typescript": "^6.0.3",
|
|
63
|
-
"vitest": "^
|
|
63
|
+
"vitest": "^5.0.3",
|
|
64
64
|
"@moxxy/tsconfig": "0.0.0",
|
|
65
65
|
"@moxxy/vitest-preset": "0.0.0"
|
|
66
66
|
},
|
package/src/ensure-fresh.test.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ensureFreshTokens } from './ensure-fresh.js';
|
|
|
6
6
|
import { withCredentialLock } from './credential-lock.js';
|
|
7
7
|
import { storeTokenSet, type OAuthVault } from './storage.js';
|
|
8
8
|
import type { OAuthProviderProfile } from './profile.js';
|
|
9
|
+
import { removeDir } from '@moxxy/vitest-preset/fs';
|
|
9
10
|
|
|
10
11
|
// The refresh path takes a cross-process lockfile under `<moxxy home>/locks`;
|
|
11
12
|
// point MOXXY_HOME at a temp dir so tests never touch the real ~/.moxxy.
|
|
@@ -18,7 +19,7 @@ beforeAll(async () => {
|
|
|
18
19
|
afterAll(async () => {
|
|
19
20
|
if (priorMoxxyHome === undefined) delete process.env.MOXXY_HOME;
|
|
20
21
|
else process.env.MOXXY_HOME = priorMoxxyHome;
|
|
21
|
-
await
|
|
22
|
+
await removeDir(moxxyHomeTmp);
|
|
22
23
|
});
|
|
23
24
|
afterEach(() => {
|
|
24
25
|
vi.unstubAllGlobals();
|
|
@@ -196,7 +197,7 @@ describe('withCredentialLock', () => {
|
|
|
196
197
|
);
|
|
197
198
|
expect(seenDuring).toEqual(['lock-test-file.lock']);
|
|
198
199
|
expect(await fs.readdir(dir)).toEqual([]);
|
|
199
|
-
await
|
|
200
|
+
await removeDir(dir);
|
|
200
201
|
});
|
|
201
202
|
|
|
202
203
|
it('takes over a stale lockfile left behind by a crashed holder', async () => {
|
|
@@ -216,7 +217,7 @@ describe('withCredentialLock', () => {
|
|
|
216
217
|
);
|
|
217
218
|
expect(ran).toBe(true);
|
|
218
219
|
expect(await fs.readdir(dir)).toEqual([]);
|
|
219
|
-
await
|
|
220
|
+
await removeDir(dir);
|
|
220
221
|
});
|
|
221
222
|
|
|
222
223
|
it('proceeds without the lock (best effort) when a live holder outlasts waitMs', async () => {
|
|
@@ -234,7 +235,7 @@ describe('withCredentialLock', () => {
|
|
|
234
235
|
expect(ran).toBe(true);
|
|
235
236
|
// The foreign lockfile must be left alone (we never owned it).
|
|
236
237
|
expect(await fs.readdir(dir)).toEqual(['lock-test-held.lock']);
|
|
237
|
-
await
|
|
238
|
+
await removeDir(dir);
|
|
238
239
|
});
|
|
239
240
|
|
|
240
241
|
it('stale takeover leaves no `.stale-*` temp litter (rename target is cleaned up)', async () => {
|
|
@@ -257,7 +258,7 @@ describe('withCredentialLock', () => {
|
|
|
257
258
|
const left = await fs.readdir(dir);
|
|
258
259
|
expect(left.filter((f) => f.includes('.stale-'))).toEqual([]);
|
|
259
260
|
expect(left).toEqual([]); // own lock released too
|
|
260
|
-
await
|
|
261
|
+
await removeDir(dir);
|
|
261
262
|
});
|
|
262
263
|
});
|
|
263
264
|
|
package/src/tools.test.ts
CHANGED
|
@@ -5,6 +5,7 @@ import * as path from 'node:path';
|
|
|
5
5
|
import { MoxxyError } from '@moxxy/sdk';
|
|
6
6
|
import { buildOauthGetTokenTool } from './tools.js';
|
|
7
7
|
import { storeTokenSet, readStoredCreds, type OAuthVault } from './storage.js';
|
|
8
|
+
import { removeDir } from '@moxxy/vitest-preset/fs';
|
|
8
9
|
|
|
9
10
|
// oauth_get_token's refresh path takes the same cross-process lockfile under
|
|
10
11
|
// `<moxxy home>/locks` that ensure-fresh.ts uses; point MOXXY_HOME at a temp
|
|
@@ -18,7 +19,7 @@ beforeAll(async () => {
|
|
|
18
19
|
afterAll(async () => {
|
|
19
20
|
if (priorMoxxyHome === undefined) delete process.env.MOXXY_HOME;
|
|
20
21
|
else process.env.MOXXY_HOME = priorMoxxyHome;
|
|
21
|
-
await
|
|
22
|
+
await removeDir(moxxyHomeTmp);
|
|
22
23
|
});
|
|
23
24
|
afterEach(() => {
|
|
24
25
|
vi.unstubAllGlobals();
|