@olane/o-core 0.8.6 → 0.8.8
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/dist/src/auth/index.d.ts +0 -1
- package/dist/src/auth/index.d.ts.map +1 -1
- package/dist/src/auth/index.js +0 -1
- package/dist/src/context/o-request-context.d.ts.map +1 -1
- package/dist/src/context/o-request-context.js +3 -1
- package/package.json +3 -3
- package/dist/src/auth/file-token-store.d.ts +0 -15
- package/dist/src/auth/file-token-store.d.ts.map +0 -1
- package/dist/src/auth/file-token-store.js +0 -55
package/dist/src/auth/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC"}
|
package/dist/src/auth/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-request-context.d.ts","sourceRoot":"","sources":["../../../src/context/o-request-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACxB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;
|
|
1
|
+
{"version":3,"file":"o-request-context.d.ts","sourceRoot":"","sources":["../../../src/context/o-request-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACxB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAkBD,eAAO,MAAM,eAAe;QACtB,CAAC,SAAS,aAAa,MAAM,MAAM,CAAC,GAAG,CAAC;gBAoBhC,aAAa,GAAG,SAAS;eAO1B,mBAAmB,GAAG,SAAS;uBAIvB,aAAa,GAAG,SAAS;CAG7C,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Runtime detection: use native AsyncLocalStorage if available (Node, Deno, Bun, CF Workers).
|
|
2
2
|
// Falls back to a simple variable for browsers/React Native where concurrent
|
|
3
3
|
// multi-user requests don't happen.
|
|
4
|
+
// Uses synchronous require() instead of top-level await import() for Hermes compatibility.
|
|
4
5
|
let nativeALS = null;
|
|
5
6
|
try {
|
|
6
|
-
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
8
|
+
const mod = require('node:async_hooks');
|
|
7
9
|
nativeALS = new mod.AsyncLocalStorage();
|
|
8
10
|
}
|
|
9
11
|
catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"typescript": "^5.8.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@olane/o-protocol": "0.8.
|
|
66
|
+
"@olane/o-protocol": "0.8.8",
|
|
67
67
|
"chalk": "^5.4.1",
|
|
68
68
|
"debug": "^4.4.1",
|
|
69
69
|
"dotenv": "^16.5.0",
|
|
70
70
|
"multiformats": "^13.3.7",
|
|
71
71
|
"stream-json": "^1.9.1"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "3e8d25714b2ee178c851c92d0f05af94572b9959"
|
|
74
74
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { oTokenStore, oTokenStoreEntry } from './o-token-store.js';
|
|
2
|
-
export interface FileTokenStoreConfig {
|
|
3
|
-
directory: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class FileTokenStore implements oTokenStore {
|
|
6
|
-
private directory;
|
|
7
|
-
private initialized;
|
|
8
|
-
constructor(config: FileTokenStoreConfig);
|
|
9
|
-
get(key: string): Promise<oTokenStoreEntry | null>;
|
|
10
|
-
set(key: string, entry: oTokenStoreEntry): Promise<void>;
|
|
11
|
-
delete(key: string): Promise<void>;
|
|
12
|
-
private keyToPath;
|
|
13
|
-
private ensureDirectory;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=file-token-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-token-store.d.ts","sourceRoot":"","sources":["../../../src/auth/file-token-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,oBAAoB;IAIlC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAqBlD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxC,OAAO,CAAC,SAAS;YAKH,eAAe;CAK9B"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { readFile, writeFile, rename, unlink, mkdir } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
export class FileTokenStore {
|
|
4
|
-
constructor(config) {
|
|
5
|
-
this.initialized = false;
|
|
6
|
-
this.directory = config.directory;
|
|
7
|
-
}
|
|
8
|
-
async get(key) {
|
|
9
|
-
await this.ensureDirectory();
|
|
10
|
-
const filePath = this.keyToPath(key);
|
|
11
|
-
let raw;
|
|
12
|
-
try {
|
|
13
|
-
raw = await readFile(filePath, 'utf-8');
|
|
14
|
-
}
|
|
15
|
-
catch (err) {
|
|
16
|
-
if (err.code === 'ENOENT')
|
|
17
|
-
return null;
|
|
18
|
-
throw err;
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
return JSON.parse(raw);
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
// Corrupted file — remove it and return null
|
|
25
|
-
await unlink(filePath).catch(() => { });
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
async set(key, entry) {
|
|
30
|
-
await this.ensureDirectory();
|
|
31
|
-
const filePath = this.keyToPath(key);
|
|
32
|
-
const tmpPath = filePath + '.tmp';
|
|
33
|
-
const data = JSON.stringify(entry, null, 2);
|
|
34
|
-
// Atomic write: write to tmp, then rename
|
|
35
|
-
await writeFile(tmpPath, data, { encoding: 'utf-8', mode: 0o600 });
|
|
36
|
-
await rename(tmpPath, filePath);
|
|
37
|
-
}
|
|
38
|
-
async delete(key) {
|
|
39
|
-
const filePath = this.keyToPath(key);
|
|
40
|
-
await unlink(filePath).catch((err) => {
|
|
41
|
-
if (err.code !== 'ENOENT')
|
|
42
|
-
throw err;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
keyToPath(key) {
|
|
46
|
-
const sanitized = key.replace(/[^a-zA-Z0-9_\-\.]/g, '_');
|
|
47
|
-
return join(this.directory, `${sanitized}.token.json`);
|
|
48
|
-
}
|
|
49
|
-
async ensureDirectory() {
|
|
50
|
-
if (this.initialized)
|
|
51
|
-
return;
|
|
52
|
-
await mkdir(this.directory, { recursive: true, mode: 0o700 });
|
|
53
|
-
this.initialized = true;
|
|
54
|
-
}
|
|
55
|
-
}
|