usage-board 3.1.2 → 3.2.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/dist/index.mjs +25 -264
- package/dist/public/_nuxt/builds/latest.json +1 -1
- package/dist/public/_nuxt/builds/meta/ae3c6372-8821-43fb-aa55-bb47729a5660.json +1 -0
- package/dist/server/chunks/nitro/nitro.mjs +64 -64
- package/dist/server/chunks/routes/api/analysis/agent/session.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/agent/token.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/cache.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/hot-project.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/model.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/overview-cards.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/session.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/token/daily.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/token.json.mjs +1 -1
- package/dist/server/chunks/routes/api/payload.json.mjs +1 -1
- package/dist/server/chunks/routes/api/projects/_project/modules.get.mjs +1 -1
- package/dist/server/chunks/routes/api/projects/catalog.get.mjs +1 -1
- package/dist/server/chunks/routes/renderer.mjs +1 -1
- package/dist/server/chunks/routes/ws.mjs +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/server/package.json +1 -4
- package/package.json +8 -6
- package/dist/public/_nuxt/builds/meta/97934cfc-fbd7-4ac5-ab89-aefedca0767f.json +0 -1
- package/dist/server/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/dist/server/node_modules/better-sqlite3/lib/database.js +0 -90
- package/dist/server/node_modules/better-sqlite3/lib/index.js +0 -3
- package/dist/server/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
- package/dist/server/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
- package/dist/server/node_modules/better-sqlite3/lib/methods/function.js +0 -31
- package/dist/server/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
- package/dist/server/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
- package/dist/server/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
- package/dist/server/node_modules/better-sqlite3/lib/methods/table.js +0 -189
- package/dist/server/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
- package/dist/server/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
- package/dist/server/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
- package/dist/server/node_modules/better-sqlite3/lib/util.js +0 -12
- package/dist/server/node_modules/better-sqlite3/package.json +0 -59
- package/dist/server/node_modules/bindings/bindings.js +0 -221
- package/dist/server/node_modules/bindings/package.json +0 -28
- package/dist/server/node_modules/file-uri-to-path/index.js +0 -66
- package/dist/server/node_modules/file-uri-to-path/package.json +0 -32
package/dist/server/index.mjs
CHANGED
package/dist/server/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usage-board-prod",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -15,14 +15,11 @@
|
|
|
15
15
|
"@vue/runtime-dom": "3.5.32",
|
|
16
16
|
"@vue/server-renderer": "3.5.32",
|
|
17
17
|
"@vue/shared": "3.5.32",
|
|
18
|
-
"better-sqlite3": "12.10.0",
|
|
19
|
-
"bindings": "1.5.0",
|
|
20
18
|
"chokidar": "5.0.0",
|
|
21
19
|
"consola": "3.4.2",
|
|
22
20
|
"devalue": "5.7.1",
|
|
23
21
|
"entities": "7.0.1",
|
|
24
22
|
"estree-walker": "2.0.2",
|
|
25
|
-
"file-uri-to-path": "1.0.0",
|
|
26
23
|
"glob": "13.0.6",
|
|
27
24
|
"hookable": "6.1.1",
|
|
28
25
|
"md5-typescript": "1.0.5",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usage-board",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"packageManager": "pnpm@10.33.0",
|
|
6
6
|
"description": "An all-in-one dashboard to quickly analyze token usage from local json files",
|
|
7
7
|
"license": "MIT",
|
|
@@ -26,17 +26,20 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.12.0"
|
|
31
|
+
},
|
|
29
32
|
"scripts": {
|
|
30
33
|
"build": "nuxt build && tsdown && rimraf ./dist/nitro.json",
|
|
31
34
|
"dev": "nuxt dev",
|
|
32
35
|
"generate": "nuxt generate",
|
|
33
36
|
"preview": "nuxt preview",
|
|
34
37
|
"typecheck": "nuxt typecheck",
|
|
35
|
-
"lint": "eslint .",
|
|
38
|
+
"lint": "nuxt prepare && eslint .",
|
|
36
39
|
"lint:fix": "eslint --fix",
|
|
37
40
|
"dev:cli": "tsdown -w",
|
|
38
41
|
"test": "vitest",
|
|
39
|
-
"prepare": "
|
|
42
|
+
"prepare": "simple-git-hooks",
|
|
40
43
|
"prepublishOnly": "pnpm build"
|
|
41
44
|
},
|
|
42
45
|
"publishConfig": {
|
|
@@ -44,10 +47,10 @@
|
|
|
44
47
|
"access": "public"
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
47
|
-
"better-sqlite3": "^12.10.0",
|
|
48
50
|
"cac": "^7.0.0",
|
|
49
51
|
"crossws": "^0.4.5",
|
|
50
|
-
"glob": "^13.0.6"
|
|
52
|
+
"glob": "^13.0.6",
|
|
53
|
+
"nuxt-devkit-server": "^0.0.1"
|
|
51
54
|
},
|
|
52
55
|
"devDependencies": {
|
|
53
56
|
"@antfu/eslint-config": "^8.2.0",
|
|
@@ -63,7 +66,6 @@
|
|
|
63
66
|
"@nuxt/icon": "^2.2.1",
|
|
64
67
|
"@tailwindcss/vite": "^4.2.2",
|
|
65
68
|
"@tanstack/vue-table": "^8.21.3",
|
|
66
|
-
"@types/better-sqlite3": "^7.6.13",
|
|
67
69
|
"@types/node": "^25.6.0",
|
|
68
70
|
"@types/ws": "^8.18.1",
|
|
69
71
|
"@unovis/ts": "^1.6.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"97934cfc-fbd7-4ac5-ab89-aefedca0767f","timestamp":1779422333685,"prerendered":[]}
|
|
Binary file
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const util = require('./util');
|
|
5
|
-
const SqliteError = require('./sqlite-error');
|
|
6
|
-
|
|
7
|
-
let DEFAULT_ADDON;
|
|
8
|
-
|
|
9
|
-
function Database(filenameGiven, options) {
|
|
10
|
-
if (new.target == null) {
|
|
11
|
-
return new Database(filenameGiven, options);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Apply defaults
|
|
15
|
-
let buffer;
|
|
16
|
-
if (Buffer.isBuffer(filenameGiven)) {
|
|
17
|
-
buffer = filenameGiven;
|
|
18
|
-
filenameGiven = ':memory:';
|
|
19
|
-
}
|
|
20
|
-
if (filenameGiven == null) filenameGiven = '';
|
|
21
|
-
if (options == null) options = {};
|
|
22
|
-
|
|
23
|
-
// Validate arguments
|
|
24
|
-
if (typeof filenameGiven !== 'string') throw new TypeError('Expected first argument to be a string');
|
|
25
|
-
if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
|
|
26
|
-
if ('readOnly' in options) throw new TypeError('Misspelled option "readOnly" should be "readonly"');
|
|
27
|
-
if ('memory' in options) throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
|
|
28
|
-
|
|
29
|
-
// Interpret options
|
|
30
|
-
const filename = filenameGiven.trim();
|
|
31
|
-
const anonymous = filename === '' || filename === ':memory:';
|
|
32
|
-
const readonly = util.getBooleanOption(options, 'readonly');
|
|
33
|
-
const fileMustExist = util.getBooleanOption(options, 'fileMustExist');
|
|
34
|
-
const timeout = 'timeout' in options ? options.timeout : 5000;
|
|
35
|
-
const verbose = 'verbose' in options ? options.verbose : null;
|
|
36
|
-
const nativeBinding = 'nativeBinding' in options ? options.nativeBinding : null;
|
|
37
|
-
|
|
38
|
-
// Validate interpreted options
|
|
39
|
-
if (readonly && anonymous && !buffer) throw new TypeError('In-memory/temporary databases cannot be readonly');
|
|
40
|
-
if (!Number.isInteger(timeout) || timeout < 0) throw new TypeError('Expected the "timeout" option to be a positive integer');
|
|
41
|
-
if (timeout > 0x7fffffff) throw new RangeError('Option "timeout" cannot be greater than 2147483647');
|
|
42
|
-
if (verbose != null && typeof verbose !== 'function') throw new TypeError('Expected the "verbose" option to be a function');
|
|
43
|
-
if (nativeBinding != null && typeof nativeBinding !== 'string' && typeof nativeBinding !== 'object') throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
|
|
44
|
-
|
|
45
|
-
// Load the native addon
|
|
46
|
-
let addon;
|
|
47
|
-
if (nativeBinding == null) {
|
|
48
|
-
addon = DEFAULT_ADDON || (DEFAULT_ADDON = require('bindings')('better_sqlite3.node'));
|
|
49
|
-
} else if (typeof nativeBinding === 'string') {
|
|
50
|
-
// See <https://webpack.js.org/api/module-variables/#__non_webpack_require__-webpack-specific>
|
|
51
|
-
const requireFunc = typeof __non_webpack_require__ === 'function' ? __non_webpack_require__ : require;
|
|
52
|
-
addon = requireFunc(path.resolve(nativeBinding).replace(/(\.node)?$/, '.node'));
|
|
53
|
-
} else {
|
|
54
|
-
// See <https://github.com/WiseLibs/better-sqlite3/issues/972>
|
|
55
|
-
addon = nativeBinding;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!addon.isInitialized) {
|
|
59
|
-
addon.setErrorConstructor(SqliteError);
|
|
60
|
-
addon.isInitialized = true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Make sure the specified directory exists
|
|
64
|
-
if (!anonymous && !filename.startsWith('file:') && !fs.existsSync(path.dirname(filename))) {
|
|
65
|
-
throw new TypeError('Cannot open database because the directory does not exist');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
Object.defineProperties(this, {
|
|
69
|
-
[util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly, fileMustExist, timeout, verbose || null, buffer || null) },
|
|
70
|
-
...wrappers.getters,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const wrappers = require('./methods/wrappers');
|
|
75
|
-
Database.prototype.prepare = wrappers.prepare;
|
|
76
|
-
Database.prototype.transaction = require('./methods/transaction');
|
|
77
|
-
Database.prototype.pragma = require('./methods/pragma');
|
|
78
|
-
Database.prototype.backup = require('./methods/backup');
|
|
79
|
-
Database.prototype.serialize = require('./methods/serialize');
|
|
80
|
-
Database.prototype.function = require('./methods/function');
|
|
81
|
-
Database.prototype.aggregate = require('./methods/aggregate');
|
|
82
|
-
Database.prototype.table = require('./methods/table');
|
|
83
|
-
Database.prototype.loadExtension = wrappers.loadExtension;
|
|
84
|
-
Database.prototype.exec = wrappers.exec;
|
|
85
|
-
Database.prototype.close = wrappers.close;
|
|
86
|
-
Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
|
|
87
|
-
Database.prototype.unsafeMode = wrappers.unsafeMode;
|
|
88
|
-
Database.prototype[util.inspect] = require('./methods/inspect');
|
|
89
|
-
|
|
90
|
-
module.exports = Database;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const { getBooleanOption, cppdb } = require('../util');
|
|
3
|
-
|
|
4
|
-
module.exports = function defineAggregate(name, options) {
|
|
5
|
-
// Validate arguments
|
|
6
|
-
if (typeof name !== 'string') throw new TypeError('Expected first argument to be a string');
|
|
7
|
-
if (typeof options !== 'object' || options === null) throw new TypeError('Expected second argument to be an options object');
|
|
8
|
-
if (!name) throw new TypeError('User-defined function name cannot be an empty string');
|
|
9
|
-
|
|
10
|
-
// Interpret options
|
|
11
|
-
const start = 'start' in options ? options.start : null;
|
|
12
|
-
const step = getFunctionOption(options, 'step', true);
|
|
13
|
-
const inverse = getFunctionOption(options, 'inverse', false);
|
|
14
|
-
const result = getFunctionOption(options, 'result', false);
|
|
15
|
-
const safeIntegers = 'safeIntegers' in options ? +getBooleanOption(options, 'safeIntegers') : 2;
|
|
16
|
-
const deterministic = getBooleanOption(options, 'deterministic');
|
|
17
|
-
const directOnly = getBooleanOption(options, 'directOnly');
|
|
18
|
-
const varargs = getBooleanOption(options, 'varargs');
|
|
19
|
-
let argCount = -1;
|
|
20
|
-
|
|
21
|
-
// Determine argument count
|
|
22
|
-
if (!varargs) {
|
|
23
|
-
argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
|
|
24
|
-
if (argCount > 0) argCount -= 1;
|
|
25
|
-
if (argCount > 100) throw new RangeError('User-defined functions cannot have more than 100 arguments');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
|
|
29
|
-
return this;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const getFunctionOption = (options, key, required) => {
|
|
33
|
-
const value = key in options ? options[key] : null;
|
|
34
|
-
if (typeof value === 'function') return value;
|
|
35
|
-
if (value != null) throw new TypeError(`Expected the "${key}" option to be a function`);
|
|
36
|
-
if (required) throw new TypeError(`Missing required option "${key}"`);
|
|
37
|
-
return null;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const getLength = ({ length }) => {
|
|
41
|
-
if (Number.isInteger(length) && length >= 0) return length;
|
|
42
|
-
throw new TypeError('Expected function.length to be a positive integer');
|
|
43
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const { promisify } = require('util');
|
|
5
|
-
const { cppdb } = require('../util');
|
|
6
|
-
const fsAccess = promisify(fs.access);
|
|
7
|
-
|
|
8
|
-
module.exports = async function backup(filename, options) {
|
|
9
|
-
if (options == null) options = {};
|
|
10
|
-
|
|
11
|
-
// Validate arguments
|
|
12
|
-
if (typeof filename !== 'string') throw new TypeError('Expected first argument to be a string');
|
|
13
|
-
if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
|
|
14
|
-
|
|
15
|
-
// Interpret options
|
|
16
|
-
filename = filename.trim();
|
|
17
|
-
const attachedName = 'attached' in options ? options.attached : 'main';
|
|
18
|
-
const handler = 'progress' in options ? options.progress : null;
|
|
19
|
-
|
|
20
|
-
// Validate interpreted options
|
|
21
|
-
if (!filename) throw new TypeError('Backup filename cannot be an empty string');
|
|
22
|
-
if (filename === ':memory:') throw new TypeError('Invalid backup filename ":memory:"');
|
|
23
|
-
if (typeof attachedName !== 'string') throw new TypeError('Expected the "attached" option to be a string');
|
|
24
|
-
if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
|
|
25
|
-
if (handler != null && typeof handler !== 'function') throw new TypeError('Expected the "progress" option to be a function');
|
|
26
|
-
|
|
27
|
-
// Make sure the specified directory exists
|
|
28
|
-
await fsAccess(path.dirname(filename)).catch(() => {
|
|
29
|
-
throw new TypeError('Cannot save backup because the directory does not exist');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const isNewFile = await fsAccess(filename).then(() => false, () => true);
|
|
33
|
-
return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler || null);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const runBackup = (backup, handler) => {
|
|
37
|
-
let rate = 0;
|
|
38
|
-
let useDefault = true;
|
|
39
|
-
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
setImmediate(function step() {
|
|
42
|
-
try {
|
|
43
|
-
const progress = backup.transfer(rate);
|
|
44
|
-
if (!progress.remainingPages) {
|
|
45
|
-
backup.close();
|
|
46
|
-
resolve(progress);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (useDefault) {
|
|
50
|
-
useDefault = false;
|
|
51
|
-
rate = 100;
|
|
52
|
-
}
|
|
53
|
-
if (handler) {
|
|
54
|
-
const ret = handler(progress);
|
|
55
|
-
if (ret !== undefined) {
|
|
56
|
-
if (typeof ret === 'number' && ret === ret) rate = Math.max(0, Math.min(0x7fffffff, Math.round(ret)));
|
|
57
|
-
else throw new TypeError('Expected progress callback to return a number or undefined');
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
setImmediate(step);
|
|
61
|
-
} catch (err) {
|
|
62
|
-
backup.close();
|
|
63
|
-
reject(err);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const { getBooleanOption, cppdb } = require('../util');
|
|
3
|
-
|
|
4
|
-
module.exports = function defineFunction(name, options, fn) {
|
|
5
|
-
// Apply defaults
|
|
6
|
-
if (options == null) options = {};
|
|
7
|
-
if (typeof options === 'function') { fn = options; options = {}; }
|
|
8
|
-
|
|
9
|
-
// Validate arguments
|
|
10
|
-
if (typeof name !== 'string') throw new TypeError('Expected first argument to be a string');
|
|
11
|
-
if (typeof fn !== 'function') throw new TypeError('Expected last argument to be a function');
|
|
12
|
-
if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
|
|
13
|
-
if (!name) throw new TypeError('User-defined function name cannot be an empty string');
|
|
14
|
-
|
|
15
|
-
// Interpret options
|
|
16
|
-
const safeIntegers = 'safeIntegers' in options ? +getBooleanOption(options, 'safeIntegers') : 2;
|
|
17
|
-
const deterministic = getBooleanOption(options, 'deterministic');
|
|
18
|
-
const directOnly = getBooleanOption(options, 'directOnly');
|
|
19
|
-
const varargs = getBooleanOption(options, 'varargs');
|
|
20
|
-
let argCount = -1;
|
|
21
|
-
|
|
22
|
-
// Determine argument count
|
|
23
|
-
if (!varargs) {
|
|
24
|
-
argCount = fn.length;
|
|
25
|
-
if (!Number.isInteger(argCount) || argCount < 0) throw new TypeError('Expected function.length to be a positive integer');
|
|
26
|
-
if (argCount > 100) throw new RangeError('User-defined functions cannot have more than 100 arguments');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
this[cppdb].function(fn, name, argCount, safeIntegers, deterministic, directOnly);
|
|
30
|
-
return this;
|
|
31
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const { getBooleanOption, cppdb } = require('../util');
|
|
3
|
-
|
|
4
|
-
module.exports = function pragma(source, options) {
|
|
5
|
-
if (options == null) options = {};
|
|
6
|
-
if (typeof source !== 'string') throw new TypeError('Expected first argument to be a string');
|
|
7
|
-
if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
|
|
8
|
-
const simple = getBooleanOption(options, 'simple');
|
|
9
|
-
|
|
10
|
-
const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
|
|
11
|
-
return simple ? stmt.pluck().get() : stmt.all();
|
|
12
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const { cppdb } = require('../util');
|
|
3
|
-
|
|
4
|
-
module.exports = function serialize(options) {
|
|
5
|
-
if (options == null) options = {};
|
|
6
|
-
|
|
7
|
-
// Validate arguments
|
|
8
|
-
if (typeof options !== 'object') throw new TypeError('Expected first argument to be an options object');
|
|
9
|
-
|
|
10
|
-
// Interpret and validate options
|
|
11
|
-
const attachedName = 'attached' in options ? options.attached : 'main';
|
|
12
|
-
if (typeof attachedName !== 'string') throw new TypeError('Expected the "attached" option to be a string');
|
|
13
|
-
if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
|
|
14
|
-
|
|
15
|
-
return this[cppdb].serialize(attachedName);
|
|
16
|
-
};
|