token-usage-dashboard 1.0.6
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/LICENSE +21 -0
- package/README.md +151 -0
- package/bin/ai-usage-dashboard.js +92 -0
- package/build/client/_app/immutable/assets/0.fjR0gTLF.css +1 -0
- package/build/client/_app/immutable/assets/0.fjR0gTLF.css.br +0 -0
- package/build/client/_app/immutable/assets/0.fjR0gTLF.css.gz +0 -0
- package/build/client/_app/immutable/assets/2.BABRsmGA.css +1 -0
- package/build/client/_app/immutable/assets/2.BABRsmGA.css.br +0 -0
- package/build/client/_app/immutable/assets/2.BABRsmGA.css.gz +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DC6tN2WI.js +3 -0
- package/build/client/_app/immutable/chunks/DC6tN2WI.js.br +0 -0
- package/build/client/_app/immutable/chunks/DC6tN2WI.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DRLSLo2t.js +2 -0
- package/build/client/_app/immutable/chunks/DRLSLo2t.js.br +0 -0
- package/build/client/_app/immutable/chunks/DRLSLo2t.js.gz +0 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.C7Gg5PnI.js +2 -0
- package/build/client/_app/immutable/entry/app.C7Gg5PnI.js.br +0 -0
- package/build/client/_app/immutable/entry/app.C7Gg5PnI.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.fbJ-_JRS.js +1 -0
- package/build/client/_app/immutable/entry/start.fbJ-_JRS.js.br +0 -0
- package/build/client/_app/immutable/entry/start.fbJ-_JRS.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.BNwlucmP.js +1 -0
- package/build/client/_app/immutable/nodes/0.BNwlucmP.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.BNwlucmP.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.Dj3Fzim2.js +1 -0
- package/build/client/_app/immutable/nodes/1.Dj3Fzim2.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.Dj3Fzim2.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.Csi9nKxw.js +2 -0
- package/build/client/_app/immutable/nodes/2.Csi9nKxw.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.Csi9nKxw.js.gz +0 -0
- package/build/client/_app/version.json +1 -0
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/client/favicon.svg +1 -0
- package/build/client/favicon.svg.br +0 -0
- package/build/client/favicon.svg.gz +0 -0
- package/build/client/robots.txt +2 -0
- package/build/client/robots.txt.br +3 -0
- package/build/client/robots.txt.gz +0 -0
- package/build/env.js +70 -0
- package/build/handler.js +22 -0
- package/build/index.js +145 -0
- package/build/server/chunks/chunks/client.js-C1_n_a2s.js +28 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
- package/build/server/chunks/chunks/exports.js-Dd48p7Ih.js +263 -0
- package/build/server/chunks/chunks/internal.js-b-1wrnfA.js +1201 -0
- package/build/server/chunks/chunks/internal2.js-BlXt2rfE.js +22 -0
- package/build/server/chunks/chunks/queries.js-aTxz7ubg.js +676 -0
- package/build/server/chunks/chunks/range.js-CLYFtcRE.js +117 -0
- package/build/server/chunks/chunks/refresh.js-DM1hnB2Y.js +107 -0
- package/build/server/chunks/chunks/request.js-B3j1_Icg.js +20 -0
- package/build/server/chunks/chunks/server.js-mTMwhapa.js +5374 -0
- package/build/server/chunks/chunks/shared.js-7DyfRqo3.js +255 -0
- package/build/server/chunks/chunks/utils.js-DzwqnkBT.js +1049 -0
- package/build/server/chunks/entries/endpoints/api/refresh/_server.ts.js-CJa6pKKD.js +21 -0
- package/build/server/chunks/entries/endpoints/api/settings/_server.ts.js-DQt7Bc2q.js +24 -0
- package/build/server/chunks/entries/endpoints/api/usage/_server.ts.js-kInjrhtE.js +17 -0
- package/build/server/chunks/entries/fallbacks/error.svelte.js-CVKDebWa.js +68 -0
- package/build/server/chunks/entries/hooks.server.js-BbojNy1X.js +16 -0
- package/build/server/chunks/entries/pages/_layout.svelte.js-C9kkUOBf.js +9 -0
- package/build/server/chunks/entries/pages/_page.server.ts.js-Oa3Sfml2.js +17 -0
- package/build/server/chunks/entries/pages/_page.svelte.js-D91hy9R4.js +1255 -0
- package/build/server/chunks/handler-br42Ds2q.js +1475 -0
- package/build/server/chunks/index.js-CBAFVV7O.js +3972 -0
- package/build/server/chunks/manifest.js-s70ajt69.js +63 -0
- package/build/server/chunks/nodes/0.js-Bzngkdxl.js +9 -0
- package/build/server/chunks/nodes/1.js-Cvu2_eGw.js +9 -0
- package/build/server/chunks/nodes/2.js-7xvomkGu.js +20 -0
- package/build/shims.js +33 -0
- package/package.json +64 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { ae as parse, af as stringify$1 } from './server.js-mTMwhapa.js';
|
|
2
|
+
|
|
3
|
+
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
|
|
4
|
+
|
|
5
|
+
class HttpError {
|
|
6
|
+
/**
|
|
7
|
+
* @param {number} status
|
|
8
|
+
* @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body
|
|
9
|
+
*/
|
|
10
|
+
constructor(status, body) {
|
|
11
|
+
this.status = status;
|
|
12
|
+
if (typeof body === 'string') {
|
|
13
|
+
this.body = { message: body };
|
|
14
|
+
} else if (body) {
|
|
15
|
+
this.body = body;
|
|
16
|
+
} else {
|
|
17
|
+
this.body = { message: `Error: ${status}` };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
toString() {
|
|
22
|
+
return JSON.stringify(this.body);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class Redirect {
|
|
27
|
+
/**
|
|
28
|
+
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status
|
|
29
|
+
* @param {string} location
|
|
30
|
+
*/
|
|
31
|
+
constructor(status, location) {
|
|
32
|
+
try {
|
|
33
|
+
new Headers({ location });
|
|
34
|
+
} catch {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Invalid redirect location ${JSON.stringify(location)}: ` +
|
|
37
|
+
'this string contains characters that cannot be used in HTTP headers'
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this.status = status;
|
|
42
|
+
this.location = location;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* An error that was thrown from within the SvelteKit runtime that is not fatal and doesn't result in a 500, such as a 404.
|
|
48
|
+
* `SvelteKitError` goes through `handleError`.
|
|
49
|
+
* @extends Error
|
|
50
|
+
*/
|
|
51
|
+
class SvelteKitError extends Error {
|
|
52
|
+
/**
|
|
53
|
+
* @param {number} status
|
|
54
|
+
* @param {string} text
|
|
55
|
+
* @param {string} message
|
|
56
|
+
*/
|
|
57
|
+
constructor(status, text, message) {
|
|
58
|
+
super(message);
|
|
59
|
+
this.status = status;
|
|
60
|
+
this.text = text;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @template [T=undefined]
|
|
66
|
+
*/
|
|
67
|
+
class ActionFailure {
|
|
68
|
+
/**
|
|
69
|
+
* @param {number} status
|
|
70
|
+
* @param {T} data
|
|
71
|
+
*/
|
|
72
|
+
constructor(status, data) {
|
|
73
|
+
this.status = status;
|
|
74
|
+
this.data = data;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#region node_modules/@sveltejs/kit/src/utils/functions.js
|
|
79
|
+
function noop() {}
|
|
80
|
+
/**
|
|
81
|
+
* @template T
|
|
82
|
+
* @param {() => T} fn
|
|
83
|
+
*/
|
|
84
|
+
function once(fn) {
|
|
85
|
+
let done = false;
|
|
86
|
+
/** @type T */
|
|
87
|
+
let result;
|
|
88
|
+
return () => {
|
|
89
|
+
if (done) return result;
|
|
90
|
+
done = true;
|
|
91
|
+
return result = fn();
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region node_modules/@sveltejs/kit/src/runtime/utils.js
|
|
96
|
+
var text_encoder = new TextEncoder();
|
|
97
|
+
/**
|
|
98
|
+
* Like node's path.relative, but without using node
|
|
99
|
+
* @param {string} from
|
|
100
|
+
* @param {string} to
|
|
101
|
+
*/
|
|
102
|
+
function get_relative_path(from, to) {
|
|
103
|
+
const from_parts = from.split(/[/\\]/);
|
|
104
|
+
const to_parts = to.split(/[/\\]/);
|
|
105
|
+
from_parts.pop();
|
|
106
|
+
while (from_parts[0] === to_parts[0]) {
|
|
107
|
+
from_parts.shift();
|
|
108
|
+
to_parts.shift();
|
|
109
|
+
}
|
|
110
|
+
let i = from_parts.length;
|
|
111
|
+
while (i--) from_parts[i] = "..";
|
|
112
|
+
return from_parts.concat(to_parts).join("/");
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @param {Uint8Array} bytes
|
|
116
|
+
* @returns {string}
|
|
117
|
+
*/
|
|
118
|
+
function base64_encode(bytes) {
|
|
119
|
+
if (globalThis.Buffer) return globalThis.Buffer.from(bytes).toString("base64");
|
|
120
|
+
let binary = "";
|
|
121
|
+
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
122
|
+
return btoa(binary);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @param {string} encoded
|
|
126
|
+
* @returns {Uint8Array}
|
|
127
|
+
*/
|
|
128
|
+
function base64_decode(encoded) {
|
|
129
|
+
if (globalThis.Buffer) {
|
|
130
|
+
const buffer = globalThis.Buffer.from(encoded, "base64");
|
|
131
|
+
return new Uint8Array(buffer);
|
|
132
|
+
}
|
|
133
|
+
const binary = atob(encoded);
|
|
134
|
+
const bytes = new Uint8Array(binary.length);
|
|
135
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
136
|
+
return bytes;
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region node_modules/@sveltejs/kit/src/utils/error.js
|
|
140
|
+
/**
|
|
141
|
+
* @param {unknown} err
|
|
142
|
+
* @return {Error}
|
|
143
|
+
*/
|
|
144
|
+
function coalesce_to_error(err) {
|
|
145
|
+
return err instanceof Error || err && err.name && err.message ? err : new Error(JSON.stringify(err));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* This is an identity function that exists to make TypeScript less
|
|
149
|
+
* paranoid about people throwing things that aren't errors, which
|
|
150
|
+
* frankly is not something we should care about
|
|
151
|
+
* @param {unknown} error
|
|
152
|
+
*/
|
|
153
|
+
function normalize_error(error) {
|
|
154
|
+
return error;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* @param {unknown} error
|
|
158
|
+
*/
|
|
159
|
+
function get_status(error) {
|
|
160
|
+
return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @param {unknown} error
|
|
164
|
+
*/
|
|
165
|
+
function get_message(error) {
|
|
166
|
+
return error instanceof SvelteKitError ? error.text : "Internal Error";
|
|
167
|
+
}
|
|
168
|
+
var INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
|
169
|
+
var TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
|
170
|
+
/**
|
|
171
|
+
* Try to `devalue.stringify` the data object using the provided transport encoders.
|
|
172
|
+
* @param {any} data
|
|
173
|
+
* @param {Transport} transport
|
|
174
|
+
*/
|
|
175
|
+
function stringify(data, transport) {
|
|
176
|
+
const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
|
|
177
|
+
return stringify$1(data, encoders);
|
|
178
|
+
}
|
|
179
|
+
var remote_object = "__skrao";
|
|
180
|
+
var remote_map = "__skram";
|
|
181
|
+
var remote_set = "__skras";
|
|
182
|
+
var remote_file = "__skraf";
|
|
183
|
+
/** @param {Transport} transport */
|
|
184
|
+
function create_remote_arg_revivers(transport) {
|
|
185
|
+
const remote_fns_revivers = {
|
|
186
|
+
/** @type {(value: unknown) => unknown} */
|
|
187
|
+
[remote_object]: (value) => value,
|
|
188
|
+
/** @type {(value: unknown) => Map<unknown, unknown>} */
|
|
189
|
+
[remote_map]: (value) => {
|
|
190
|
+
if (!Array.isArray(value)) throw new Error("Invalid data for Map reviver");
|
|
191
|
+
const map = /* @__PURE__ */ new Map();
|
|
192
|
+
for (const item of value) {
|
|
193
|
+
if (!Array.isArray(item) || item.length !== 2 || typeof item[0] !== "string" || typeof item[1] !== "string") throw new Error("Invalid data for Map reviver");
|
|
194
|
+
const [key, val] = item;
|
|
195
|
+
map.set(parse$1(key), parse$1(val));
|
|
196
|
+
}
|
|
197
|
+
return map;
|
|
198
|
+
},
|
|
199
|
+
/** @type {(value: unknown) => Set<unknown>} */
|
|
200
|
+
[remote_set]: (value) => {
|
|
201
|
+
if (!Array.isArray(value)) throw new Error("Invalid data for Set reviver");
|
|
202
|
+
const set = /* @__PURE__ */ new Set();
|
|
203
|
+
for (const item of value) {
|
|
204
|
+
if (typeof item !== "string") throw new Error("Invalid data for Set reviver");
|
|
205
|
+
set.add(parse$1(item));
|
|
206
|
+
}
|
|
207
|
+
return set;
|
|
208
|
+
},
|
|
209
|
+
/** @type {(value: any) => File} */
|
|
210
|
+
[remote_file]: (value) => {
|
|
211
|
+
if (!value || typeof value !== "object" || typeof value.name !== "string" || typeof value.type !== "string" || typeof value.size !== "number" || typeof value.lastModified !== "number" || !(value.data instanceof ArrayBuffer)) throw new Error("Invalid data for File reviver");
|
|
212
|
+
const { data, name, ...meta } = value;
|
|
213
|
+
return new File([data], name, meta);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const all_revivers = {
|
|
217
|
+
...Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode])),
|
|
218
|
+
...remote_fns_revivers
|
|
219
|
+
};
|
|
220
|
+
/** @type {(data: string) => unknown} */
|
|
221
|
+
const parse$1 = (data) => parse(data, all_revivers);
|
|
222
|
+
return all_revivers;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Parses the argument (if any) for a remote function
|
|
226
|
+
* @param {string} string
|
|
227
|
+
* @param {Transport} transport
|
|
228
|
+
*/
|
|
229
|
+
function parse_remote_arg(string, transport) {
|
|
230
|
+
if (!string) return void 0;
|
|
231
|
+
const json_string = new TextDecoder().decode(base64_decode(string.replaceAll("-", "+").replaceAll("_", "/")));
|
|
232
|
+
return parse(json_string, create_remote_arg_revivers(transport));
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @param {string} id
|
|
236
|
+
* @param {string} payload
|
|
237
|
+
*/
|
|
238
|
+
function create_remote_key(id, payload) {
|
|
239
|
+
return id + "/" + payload;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* @param {string} key
|
|
243
|
+
* @returns {{ id: string; payload: string }}
|
|
244
|
+
*/
|
|
245
|
+
function split_remote_key(key) {
|
|
246
|
+
const i = key.lastIndexOf("/");
|
|
247
|
+
if (i === -1) throw new Error(`Invalid remote key: ${key}`);
|
|
248
|
+
return {
|
|
249
|
+
id: key.slice(0, i),
|
|
250
|
+
payload: key.slice(i + 1)
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export { ActionFailure as A, HttpError as H, INVALIDATED_PARAM as I, Redirect as R, SvelteKitError as S, TRAILING_SLASH_PARAM as T, get_message as a, get_relative_path as b, coalesce_to_error as c, normalize_error as d, create_remote_key as e, split_remote_key as f, get_status as g, base64_encode as h, noop as n, once as o, parse_remote_arg as p, stringify as s, text_encoder as t };
|
|
255
|
+
//# sourceMappingURL=shared.js-7DyfRqo3.js.map
|