@warlock.js/devtools 5.57.0 → 5.58.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/CHANGELOG.md +8 -0
- package/README.md +3 -0
- package/cjs/{auth-DzU0gHDG.cjs → auth-DV2GA1A9.cjs} +33 -403
- package/cjs/auth-DV2GA1A9.cjs.map +1 -0
- package/cjs/{boot-Dy5OqgTM.cjs → boot-CyeHPFtk.cjs} +14 -12
- package/cjs/boot-CyeHPFtk.cjs.map +1 -0
- package/cjs/{capture-CqIiaznN.cjs → capture-DcyBhdqw.cjs} +3 -3
- package/cjs/{capture-CqIiaznN.cjs.map → capture-DcyBhdqw.cjs.map} +1 -1
- package/cjs/{cascade-store-pHjKeSFm.cjs → cascade-store-DEGxAFDI.cjs} +141 -4
- package/cjs/cascade-store-DEGxAFDI.cjs.map +1 -0
- package/cjs/{contracts-CVmplkNb.cjs → contracts-CDuY-ahl.cjs} +6 -2
- package/cjs/{contracts-CVmplkNb.cjs.map → contracts-CDuY-ahl.cjs.map} +1 -1
- package/cjs/{errors-CyZp5yS-.cjs → errors-DEqdWaqm.cjs} +3 -1
- package/cjs/{errors-CyZp5yS-.cjs.map → errors-DEqdWaqm.cjs.map} +1 -1
- package/cjs/helpers-7k_Q-abk.cjs +436 -0
- package/cjs/helpers-7k_Q-abk.cjs.map +1 -0
- package/cjs/{histogram-BaI-PnCv.cjs → histogram-BRV5eHcp.cjs} +2 -2
- package/cjs/{histogram-BaI-PnCv.cjs.map → histogram-BRV5eHcp.cjs.map} +1 -1
- package/cjs/{http-DCfXQvw-.cjs → http-XNLYU2vS.cjs} +517 -28
- package/cjs/http-XNLYU2vS.cjs.map +1 -0
- package/cjs/index.cjs +1 -1
- package/cjs/{insights-BKtqxdnP.cjs → insights-BBZnUpWO.cjs} +4 -3
- package/cjs/{insights-BKtqxdnP.cjs.map → insights-BBZnUpWO.cjs.map} +1 -1
- package/cjs/{migrations-w7GMsrQw.cjs → migrations-DTTzCNpR.cjs} +38 -3
- package/cjs/migrations-DTTzCNpR.cjs.map +1 -0
- package/cjs/{options-CWqFC5__.cjs → options-CHhmQJic.cjs} +16 -4
- package/cjs/options-CHhmQJic.cjs.map +1 -0
- package/cjs/{panels-Rcmeitu3.cjs → panels-CHd20RK5.cjs} +74 -7
- package/cjs/panels-CHd20RK5.cjs.map +1 -0
- package/cjs/production/index.cjs +4 -4
- package/cjs/{server-ykxsOwob.cjs → server-C8JfggQU.cjs} +5 -4
- package/cjs/server-C8JfggQU.cjs.map +1 -0
- package/cjs/{src-UPtTCI2j.cjs → src-DjOUdhKc.cjs} +47 -10
- package/cjs/src-DjOUdhKc.cjs.map +1 -0
- package/cjs/{store-aq207T8v.cjs → store-C06KO_A1.cjs} +2 -2
- package/cjs/{stream-route-CJTABkUy.cjs → stream-route-D4k-sJvW.cjs} +70 -9
- package/cjs/stream-route-D4k-sJvW.cjs.map +1 -0
- package/esm/devtools-connector.d.mts.map +1 -1
- package/esm/devtools-connector.mjs +10 -3
- package/esm/devtools-connector.mjs.map +1 -1
- package/esm/index.d.mts +3 -3
- package/esm/panel-errors.mjs +33 -0
- package/esm/panel-errors.mjs.map +1 -0
- package/esm/panels.mjs +73 -6
- package/esm/panels.mjs.map +1 -1
- package/esm/production/auth/service.mjs +4 -2
- package/esm/production/auth/service.mjs.map +1 -1
- package/esm/production/boot.mjs +4 -2
- package/esm/production/boot.mjs.map +1 -1
- package/esm/production/contracts.d.mts +68 -2
- package/esm/production/contracts.d.mts.map +1 -1
- package/esm/production/contracts.mjs +5 -1
- package/esm/production/contracts.mjs.map +1 -1
- package/esm/production/errors.mjs +2 -0
- package/esm/production/errors.mjs.map +1 -1
- package/esm/production/http/access.mjs +6 -2
- package/esm/production/http/access.mjs.map +1 -1
- package/esm/production/http/constants.mjs +7 -1
- package/esm/production/http/constants.mjs.map +1 -1
- package/esm/production/http/context.mjs.map +1 -1
- package/esm/production/http/cookie.mjs +23 -2
- package/esm/production/http/cookie.mjs.map +1 -1
- package/esm/production/http/mount.mjs +25 -3
- package/esm/production/http/mount.mjs.map +1 -1
- package/esm/production/http/share-session.mjs +114 -0
- package/esm/production/http/share-session.mjs.map +1 -0
- package/esm/production/http/share.mjs +339 -0
- package/esm/production/http/share.mjs.map +1 -0
- package/esm/production/index.d.mts +2 -2
- package/esm/production/insights/writer.mjs +2 -1
- package/esm/production/insights/writer.mjs.map +1 -1
- package/esm/production/options.d.mts +5 -0
- package/esm/production/options.d.mts.map +1 -1
- package/esm/production/options.mjs +14 -2
- package/esm/production/options.mjs.map +1 -1
- package/esm/production/store/cascade-store.mjs +49 -2
- package/esm/production/store/cascade-store.mjs.map +1 -1
- package/esm/production/store/mapping.mjs +29 -1
- package/esm/production/store/mapping.mjs.map +1 -1
- package/esm/production/store/memory-store.mjs +62 -0
- package/esm/production/store/memory-store.mjs.map +1 -1
- package/esm/production/store/migrations.d.mts +2 -1
- package/esm/production/store/migrations.d.mts.map +1 -1
- package/esm/production/store/migrations.mjs +5 -2
- package/esm/production/store/migrations.mjs.map +1 -1
- package/esm/production/store/models/index.mjs +3 -1
- package/esm/production/store/models/share.migration.mjs +27 -0
- package/esm/production/store/models/share.migration.mjs.map +1 -0
- package/esm/production/store/models/share.model.mjs +13 -0
- package/esm/production/store/models/share.model.mjs.map +1 -0
- package/esm/server/panel-files.mjs +35 -0
- package/esm/server/panel-files.mjs.map +1 -0
- package/esm/server/panel-routes.mjs +27 -7
- package/esm/server/panel-routes.mjs.map +1 -1
- package/esm/server/session-routes.mjs +2 -1
- package/esm/server/session-routes.mjs.map +1 -1
- package/esm/types.d.mts +81 -2
- package/esm/types.d.mts.map +1 -1
- package/llms-full.txt +34 -4
- package/package.json +8 -8
- package/skills/SKILL.md +34 -4
- package/ui/dashboard/assets/app.css +1 -1
- package/ui/dashboard/assets/app.js +16 -16
- package/ui/dashboard/build-info.json +7 -7
- package/cjs/auth-DzU0gHDG.cjs.map +0 -1
- package/cjs/boot-Dy5OqgTM.cjs.map +0 -1
- package/cjs/cascade-store-pHjKeSFm.cjs.map +0 -1
- package/cjs/http-DCfXQvw-.cjs.map +0 -1
- package/cjs/migrations-w7GMsrQw.cjs.map +0 -1
- package/cjs/options-CWqFC5__.cjs.map +0 -1
- package/cjs/panels-Rcmeitu3.cjs.map +0 -1
- package/cjs/server-ykxsOwob.cjs.map +0 -1
- package/cjs/src-UPtTCI2j.cjs.map +0 -1
- package/cjs/stream-route-CJTABkUy.cjs.map +0 -1
|
@@ -54,6 +54,7 @@ function createMemoryStore(options = {}) {
|
|
|
54
54
|
const accounts = /* @__PURE__ */ new Map();
|
|
55
55
|
const sessions = /* @__PURE__ */ new Map();
|
|
56
56
|
const invites = /* @__PURE__ */ new Map();
|
|
57
|
+
const shares = /* @__PURE__ */ new Map();
|
|
57
58
|
const audit = [];
|
|
58
59
|
const samples = /* @__PURE__ */ new Map();
|
|
59
60
|
const reports = /* @__PURE__ */ new Map();
|
|
@@ -282,6 +283,67 @@ function createMemoryStore(options = {}) {
|
|
|
282
283
|
async remove(instanceId) {
|
|
283
284
|
return reports.delete(instanceId);
|
|
284
285
|
}
|
|
286
|
+
},
|
|
287
|
+
shares: {
|
|
288
|
+
async create(input) {
|
|
289
|
+
for (const share of shares.values()) if (share.tokenHash === input.tokenHash) throw new DevtoolsStoreConflictError("tokenHash");
|
|
290
|
+
const record = {
|
|
291
|
+
...copy(input),
|
|
292
|
+
id: randomUUID(),
|
|
293
|
+
revokedAt: null,
|
|
294
|
+
lastUsedAt: null,
|
|
295
|
+
uses: 0
|
|
296
|
+
};
|
|
297
|
+
shares.set(record.id, record);
|
|
298
|
+
return copy(record);
|
|
299
|
+
},
|
|
300
|
+
async findByTokenHash(tokenHash) {
|
|
301
|
+
for (const share of shares.values()) if (share.tokenHash === tokenHash) return copy(share);
|
|
302
|
+
return null;
|
|
303
|
+
},
|
|
304
|
+
async get(id) {
|
|
305
|
+
const share = shares.get(id);
|
|
306
|
+
return share ? copy(share) : null;
|
|
307
|
+
},
|
|
308
|
+
async list() {
|
|
309
|
+
return [...shares.values()].sort((a, b) => b.createdAt - a.createdAt).map(copy);
|
|
310
|
+
},
|
|
311
|
+
async revoke(id, at) {
|
|
312
|
+
const share = shares.get(id);
|
|
313
|
+
if (!share || share.revokedAt !== null) return false;
|
|
314
|
+
shares.set(id, {
|
|
315
|
+
...share,
|
|
316
|
+
revokedAt: at
|
|
317
|
+
});
|
|
318
|
+
return true;
|
|
319
|
+
},
|
|
320
|
+
async revokeAll(at) {
|
|
321
|
+
let revoked = 0;
|
|
322
|
+
for (const share of [...shares.values()]) if (share.revokedAt === null && share.expiresAt > at) {
|
|
323
|
+
shares.set(share.id, {
|
|
324
|
+
...share,
|
|
325
|
+
revokedAt: at
|
|
326
|
+
});
|
|
327
|
+
revoked++;
|
|
328
|
+
}
|
|
329
|
+
return revoked;
|
|
330
|
+
},
|
|
331
|
+
async touch(id, at) {
|
|
332
|
+
const share = shares.get(id);
|
|
333
|
+
if (share) shares.set(id, {
|
|
334
|
+
...share,
|
|
335
|
+
lastUsedAt: at,
|
|
336
|
+
uses: share.uses + 1
|
|
337
|
+
});
|
|
338
|
+
},
|
|
339
|
+
async removeOld(before) {
|
|
340
|
+
let removed = 0;
|
|
341
|
+
for (const share of [...shares.values()]) if (share.expiresAt < before || share.revokedAt !== null && share.revokedAt < before) {
|
|
342
|
+
shares.delete(share.id);
|
|
343
|
+
removed++;
|
|
344
|
+
}
|
|
345
|
+
return removed;
|
|
346
|
+
}
|
|
285
347
|
}
|
|
286
348
|
};
|
|
287
349
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.mjs","names":[],"sources":["../../../../../../../../../packages/devtools/src/production/store/memory-store.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type {\n DevtoolsAuditEntry,\n DevtoolsInstanceReport,\n DevtoolsSampleSummary,\n} from \"../contracts\";\nimport { DevtoolsStoreConflictError } from \"../errors\";\nimport { rateLimitClient } from \"../http/ip\";\nimport type {\n DevtoolsAccountRecord,\n DevtoolsInviteRecord,\n DevtoolsSampleFilter,\n DevtoolsSessionRecord,\n DevtoolsStateRecord,\n DevtoolsStore,\n DevtoolsStoredSample,\n} from \"./types\";\n\n/** A structural copy, so callers never hold the store's own objects. */\nfunction copy<T>(value: T): T {\n return structuredClone(value);\n}\n\n/** The state row before anything was written. */\nexport function defaultStateRecord(now = 0): DevtoolsStateRecord {\n return {\n disabled: false,\n disabledPathHash: null,\n disabledAt: null,\n disabledBy: null,\n lockedUntil: null,\n failuresResetAt: null,\n updatedAt: now,\n version: 0,\n };\n}\n\n/** Whether `status` matches a sample filter value: `\"5xx\"`, `\"4xx\"`, `\"404\"`. */\nexport function sampleStatusMatches(filter: string, status: number | undefined): boolean {\n if (status === undefined) return false;\n\n const value = filter.trim().toLowerCase();\n\n if (/^[1-5]xx$/.test(value)) return Math.floor(status / 100) === Number(value[0]);\n\n return String(status) === value;\n}\n\n/** Whether a sample summary passes `filter` (everything but `limit`). */\nexport function sampleMatches(\n summary: DevtoolsSampleSummary,\n filter: DevtoolsSampleFilter,\n): boolean {\n if (filter.status !== undefined && !sampleStatusMatches(filter.status, summary.status))\n return false;\n if (filter.method !== undefined && summary.method.toUpperCase() !== filter.method.toUpperCase()) {\n return false;\n }\n\n if (filter.route !== undefined) {\n const needle = filter.route.toLowerCase();\n const haystack = `${summary.route ?? \"\"} ${summary.path}`.toLowerCase();\n\n if (!haystack.includes(needle)) return false;\n }\n\n if (filter.q !== undefined && !summary.path.toLowerCase().includes(filter.q.toLowerCase())) {\n return false;\n }\n\n if (filter.since !== undefined && summary.startedAt < filter.since) return false;\n if (filter.until !== undefined && summary.startedAt > filter.until) return false;\n if (filter.instance !== undefined && summary.instance !== filter.instance) return false;\n\n return true;\n}\n\n/**\n * An in-process `DevtoolsStore` for specs (and nothing else: it is neither\n * shared between processes nor kept across restarts). It follows the store\n * contract exactly, compare-and-set included, so a spec written against it\n * holds for the database store too.\n *\n * `now` is read for `updatedAt` stamps; pass a fake clock in specs.\n */\nexport function createMemoryStore(options: { now?: () => number } = {}): DevtoolsStore {\n const now = options.now ?? Date.now;\n const accounts = new Map<string, DevtoolsAccountRecord>();\n const sessions = new Map<string, DevtoolsSessionRecord>();\n const invites = new Map<string, DevtoolsInviteRecord>();\n const audit: DevtoolsAuditEntry[] = [];\n const samples = new Map<string, DevtoolsStoredSample>();\n const reports = new Map<string, DevtoolsInstanceReport>();\n let state: DevtoolsStateRecord | null = null;\n\n return {\n async verify() {},\n\n accounts: {\n async findByEmail(email) {\n for (const account of accounts.values()) {\n if (account.email === email) return copy(account);\n }\n\n return null;\n },\n async findById(id) {\n const account = accounts.get(id);\n\n return account ? copy(account) : null;\n },\n async list() {\n return [...accounts.values()].sort((a, b) => a.createdAt - b.createdAt).map(copy);\n },\n async countAdmins() {\n return [...accounts.values()].filter((account) => account.role === \"admin\").length;\n },\n async create(input) {\n for (const account of accounts.values()) {\n if (account.email === input.email) throw new DevtoolsStoreConflictError(\"email\");\n }\n\n const at = now();\n const record: DevtoolsAccountRecord = {\n ...copy(input),\n id: randomUUID(),\n createdAt: at,\n updatedAt: at,\n version: 1,\n };\n\n accounts.set(record.id, record);\n\n return copy(record);\n },\n async update(id, expectedVersion, patch) {\n const current = accounts.get(id);\n\n if (!current || current.version !== expectedVersion) return null;\n\n if (patch.email !== undefined && patch.email !== current.email) {\n for (const account of accounts.values()) {\n if (account.email === patch.email) throw new DevtoolsStoreConflictError(\"email\");\n }\n }\n\n const next: DevtoolsAccountRecord = {\n ...current,\n ...copy(patch),\n id,\n createdAt: current.createdAt,\n updatedAt: now(),\n version: current.version + 1,\n };\n\n accounts.set(id, next);\n\n return copy(next);\n },\n async remove(id) {\n return accounts.delete(id);\n },\n },\n\n sessions: {\n async create(input) {\n const record: DevtoolsSessionRecord = { ...copy(input), id: randomUUID(), version: 1 };\n\n sessions.set(record.id, record);\n\n return copy(record);\n },\n async findByTokenHash(tokenHash) {\n for (const session of sessions.values()) {\n if (session.tokenHash === tokenHash) return copy(session);\n }\n\n return null;\n },\n async listForAccount(accountId) {\n return [...sessions.values()]\n .filter((session) => session.accountId === accountId)\n .sort((a, b) => b.createdAt - a.createdAt)\n .map(copy);\n },\n async update(id, expectedVersion, patch) {\n const current = sessions.get(id);\n\n if (!current || current.version !== expectedVersion) return null;\n\n const next: DevtoolsSessionRecord = {\n ...current,\n ...copy(patch),\n id,\n accountId: current.accountId,\n version: current.version + 1,\n };\n\n sessions.set(id, next);\n\n return copy(next);\n },\n async remove(id) {\n return sessions.delete(id);\n },\n async removeForAccount(accountId, exceptId) {\n let removed = 0;\n\n for (const session of [...sessions.values()]) {\n if (session.accountId === accountId && session.id !== exceptId) {\n sessions.delete(session.id);\n removed++;\n }\n }\n\n return removed;\n },\n async removeExpired(at) {\n let removed = 0;\n\n for (const session of [...sessions.values()]) {\n if (session.expiresAt < at) {\n sessions.delete(session.id);\n removed++;\n }\n }\n\n return removed;\n },\n },\n\n invites: {\n async create(input) {\n const record: DevtoolsInviteRecord = {\n ...copy(input),\n id: randomUUID(),\n usedAt: null,\n accountId: null,\n };\n\n invites.set(record.id, record);\n\n return copy(record);\n },\n async findByTokenHash(tokenHash) {\n for (const invite of invites.values()) {\n if (invite.tokenHash === tokenHash) return copy(invite);\n }\n\n return null;\n },\n async list(listOptions = {}) {\n return [...invites.values()]\n .filter((invite) => listOptions.includeUsed === true || invite.usedAt === null)\n .sort((a, b) => b.createdAt - a.createdAt)\n .map(copy);\n },\n async markUsed(id, at, accountId) {\n const invite = invites.get(id);\n\n if (!invite || invite.usedAt !== null || at >= invite.expiresAt) return false;\n\n invites.set(id, { ...invite, usedAt: at, accountId });\n\n return true;\n },\n async remove(id) {\n return invites.delete(id);\n },\n async removeExpired(at) {\n let removed = 0;\n\n for (const invite of [...invites.values()]) {\n if (invite.usedAt === null && invite.expiresAt < at) {\n invites.delete(invite.id);\n removed++;\n }\n }\n\n return removed;\n },\n },\n\n audit: {\n async append(entry) {\n const record: DevtoolsAuditEntry = { ...copy(entry), id: randomUUID() };\n\n audit.push(record);\n\n return copy(record);\n },\n async list(filter) {\n const limit = Math.max(1, Math.min(500, filter.limit));\n\n return audit\n .filter(\n (entry) =>\n (filter.types === undefined || filter.types.includes(entry.type)) &&\n (filter.accountId === undefined || entry.accountId === filter.accountId) &&\n (filter.before === undefined || entry.at < filter.before),\n )\n .sort((a, b) => b.at - a.at)\n .slice(0, limit)\n .map(copy);\n },\n async count(filter) {\n return audit.filter(\n (entry) =>\n filter.types.includes(entry.type) &&\n entry.at >= filter.since &&\n (filter.accountId === undefined || entry.accountId === filter.accountId) &&\n (filter.ip === undefined ||\n (entry.ip !== null && rateLimitClient(entry.ip) === rateLimitClient(filter.ip))),\n ).length;\n },\n async prune(before) {\n const kept = audit.filter((entry) => entry.at >= before);\n const removed = audit.length - kept.length;\n\n audit.splice(0, audit.length, ...kept);\n\n return removed;\n },\n },\n\n state: {\n async read() {\n return copy(state ?? defaultStateRecord(now()));\n },\n async update(expectedVersion, patch) {\n const current = state ?? defaultStateRecord(now());\n\n if (current.version !== expectedVersion) return null;\n\n state = { ...current, ...copy(patch), updatedAt: now(), version: current.version + 1 };\n\n return copy(state);\n },\n },\n\n samples: {\n async insert(list) {\n for (const sample of list) samples.set(sample.id, copy(sample));\n },\n async list(filter) {\n const limit = Math.max(1, Math.min(1000, filter.limit));\n\n return [...samples.values()]\n .map((sample) => sample.summary)\n .filter((summary) => sampleMatches(summary, filter))\n .sort((a, b) => b.startedAt - a.startedAt)\n .slice(0, limit)\n .map(copy);\n },\n async get(id) {\n const sample = samples.get(id);\n\n return sample ? copy(sample) : null;\n },\n async prune(before) {\n let removed = 0;\n\n for (const sample of [...samples.values()]) {\n if (sample.startedAt < before) {\n samples.delete(sample.id);\n removed++;\n }\n }\n\n return removed;\n },\n async clear() {\n const removed = samples.size;\n\n samples.clear();\n\n return removed;\n },\n },\n\n reports: {\n async write(report) {\n reports.set(report.instance.id, copy(report));\n },\n async list(seenSince) {\n return [...reports.values()]\n .filter((report) => report.at >= seenSince)\n .sort((a, b) => b.at - a.at)\n .map(copy);\n },\n async prune(seenBefore) {\n let removed = 0;\n\n for (const report of [...reports.values()]) {\n if (report.at < seenBefore) {\n reports.delete(report.instance.id);\n removed++;\n }\n }\n\n return removed;\n },\n async remove(instanceId) {\n return reports.delete(instanceId);\n },\n },\n };\n}\n"],"mappings":";;;;;;AAmBA,SAAS,KAAQ,OAAa;CAC5B,OAAO,gBAAgB,KAAK;AAC9B;;AAGA,SAAgB,mBAAmB,MAAM,GAAwB;CAC/D,OAAO;EACL,UAAU;EACV,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,WAAW;EACX,SAAS;CACX;AACF;;AAGA,SAAgB,oBAAoB,QAAgB,QAAqC;CACvF,IAAI,WAAW,QAAW,OAAO;CAEjC,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,YAAY;CAExC,IAAI,YAAY,KAAK,KAAK,GAAG,OAAO,KAAK,MAAM,SAAS,GAAG,MAAM,OAAO,MAAM,EAAE;CAEhF,OAAO,OAAO,MAAM,MAAM;AAC5B;;AAGA,SAAgB,cACd,SACA,QACS;CACT,IAAI,OAAO,WAAW,UAAa,CAAC,oBAAoB,OAAO,QAAQ,QAAQ,MAAM,GACnF,OAAO;CACT,IAAI,OAAO,WAAW,UAAa,QAAQ,OAAO,YAAY,MAAM,OAAO,OAAO,YAAY,GAC5F,OAAO;CAGT,IAAI,OAAO,UAAU,QAAW;EAC9B,MAAM,SAAS,OAAO,MAAM,YAAY;EAGxC,IAAI,CAFa,GAAG,QAAQ,SAAS,GAAG,GAAG,QAAQ,OAAO,YAE9C,CAAC,CAAC,SAAS,MAAM,GAAG,OAAO;CACzC;CAEA,IAAI,OAAO,MAAM,UAAa,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,SAAS,OAAO,EAAE,YAAY,CAAC,GACvF,OAAO;CAGT,IAAI,OAAO,UAAU,UAAa,QAAQ,YAAY,OAAO,OAAO,OAA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7B,QAAQ,OAAO,OAAO,EAAE;KACxB;IACF;IAGF,OAAO;GACT;GACA,MAAM,QAAQ;IACZ,MAAM,UAAU,QAAQ;IAExB,QAAQ,MAAM;IAEd,OAAO;GACT;EACF;EAEA,SAAS;GACP,MAAM,MAAM,QAAQ;IAClB,QAAQ,IAAI,OAAO,SAAS,IAAI,KAAK,MAAM,CAAC;GAC9C;GACA,MAAM,KAAK,WAAW;IACpB,OAAO,CAAC,GAAG,QAAQ,OAAO,CAAC,CAAC,CACzB,QAAQ,WAAW,OAAO,MAAM,SAAS,CAAC,CAC1C,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC3B,IAAI,IAAI;GACb;GACA,MAAM,MAAM,YAAY;IACtB,IAAI,UAAU;IAEd,KAAK,MAAM,UAAU,CAAC,GAAG,QAAQ,OAAO,CAAC,GACvC,IAAI,OAAO,KAAK,YAAY;KAC1B,QAAQ,OAAO,OAAO,SAAS,EAAE;KACjC;IACF;IAGF,OAAO;GACT;GACA,MAAM,OAAO,YAAY;IACvB,OAAO,QAAQ,OAAO,UAAU;GAClC;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"memory-store.mjs","names":[],"sources":["../../../../../../../../../packages/devtools/src/production/store/memory-store.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type {\n DevtoolsAuditEntry,\n DevtoolsInstanceReport,\n DevtoolsSampleSummary,\n} from \"../contracts\";\nimport { DevtoolsStoreConflictError } from \"../errors\";\nimport { rateLimitClient } from \"../http/ip\";\nimport type {\n DevtoolsAccountRecord,\n DevtoolsInviteRecord,\n DevtoolsSampleFilter,\n DevtoolsSessionRecord,\n DevtoolsShareRecord,\n DevtoolsStateRecord,\n DevtoolsStore,\n DevtoolsStoredSample,\n} from \"./types\";\n\n/** A structural copy, so callers never hold the store's own objects. */\nfunction copy<T>(value: T): T {\n return structuredClone(value);\n}\n\n/** The state row before anything was written. */\nexport function defaultStateRecord(now = 0): DevtoolsStateRecord {\n return {\n disabled: false,\n disabledPathHash: null,\n disabledAt: null,\n disabledBy: null,\n lockedUntil: null,\n failuresResetAt: null,\n updatedAt: now,\n version: 0,\n };\n}\n\n/** Whether `status` matches a sample filter value: `\"5xx\"`, `\"4xx\"`, `\"404\"`. */\nexport function sampleStatusMatches(filter: string, status: number | undefined): boolean {\n if (status === undefined) return false;\n\n const value = filter.trim().toLowerCase();\n\n if (/^[1-5]xx$/.test(value)) return Math.floor(status / 100) === Number(value[0]);\n\n return String(status) === value;\n}\n\n/** Whether a sample summary passes `filter` (everything but `limit`). */\nexport function sampleMatches(\n summary: DevtoolsSampleSummary,\n filter: DevtoolsSampleFilter,\n): boolean {\n if (filter.status !== undefined && !sampleStatusMatches(filter.status, summary.status))\n return false;\n if (filter.method !== undefined && summary.method.toUpperCase() !== filter.method.toUpperCase()) {\n return false;\n }\n\n if (filter.route !== undefined) {\n const needle = filter.route.toLowerCase();\n const haystack = `${summary.route ?? \"\"} ${summary.path}`.toLowerCase();\n\n if (!haystack.includes(needle)) return false;\n }\n\n if (filter.q !== undefined && !summary.path.toLowerCase().includes(filter.q.toLowerCase())) {\n return false;\n }\n\n if (filter.since !== undefined && summary.startedAt < filter.since) return false;\n if (filter.until !== undefined && summary.startedAt > filter.until) return false;\n if (filter.instance !== undefined && summary.instance !== filter.instance) return false;\n\n return true;\n}\n\n/**\n * An in-process `DevtoolsStore` for specs (and nothing else: it is neither\n * shared between processes nor kept across restarts). It follows the store\n * contract exactly, compare-and-set included, so a spec written against it\n * holds for the database store too.\n *\n * `now` is read for `updatedAt` stamps; pass a fake clock in specs.\n */\nexport function createMemoryStore(options: { now?: () => number } = {}): DevtoolsStore {\n const now = options.now ?? Date.now;\n const accounts = new Map<string, DevtoolsAccountRecord>();\n const sessions = new Map<string, DevtoolsSessionRecord>();\n const invites = new Map<string, DevtoolsInviteRecord>();\n const shares = new Map<string, DevtoolsShareRecord>();\n const audit: DevtoolsAuditEntry[] = [];\n const samples = new Map<string, DevtoolsStoredSample>();\n const reports = new Map<string, DevtoolsInstanceReport>();\n let state: DevtoolsStateRecord | null = null;\n\n return {\n async verify() {},\n\n accounts: {\n async findByEmail(email) {\n for (const account of accounts.values()) {\n if (account.email === email) return copy(account);\n }\n\n return null;\n },\n async findById(id) {\n const account = accounts.get(id);\n\n return account ? copy(account) : null;\n },\n async list() {\n return [...accounts.values()].sort((a, b) => a.createdAt - b.createdAt).map(copy);\n },\n async countAdmins() {\n return [...accounts.values()].filter((account) => account.role === \"admin\").length;\n },\n async create(input) {\n for (const account of accounts.values()) {\n if (account.email === input.email) throw new DevtoolsStoreConflictError(\"email\");\n }\n\n const at = now();\n const record: DevtoolsAccountRecord = {\n ...copy(input),\n id: randomUUID(),\n createdAt: at,\n updatedAt: at,\n version: 1,\n };\n\n accounts.set(record.id, record);\n\n return copy(record);\n },\n async update(id, expectedVersion, patch) {\n const current = accounts.get(id);\n\n if (!current || current.version !== expectedVersion) return null;\n\n if (patch.email !== undefined && patch.email !== current.email) {\n for (const account of accounts.values()) {\n if (account.email === patch.email) throw new DevtoolsStoreConflictError(\"email\");\n }\n }\n\n const next: DevtoolsAccountRecord = {\n ...current,\n ...copy(patch),\n id,\n createdAt: current.createdAt,\n updatedAt: now(),\n version: current.version + 1,\n };\n\n accounts.set(id, next);\n\n return copy(next);\n },\n async remove(id) {\n return accounts.delete(id);\n },\n },\n\n sessions: {\n async create(input) {\n const record: DevtoolsSessionRecord = { ...copy(input), id: randomUUID(), version: 1 };\n\n sessions.set(record.id, record);\n\n return copy(record);\n },\n async findByTokenHash(tokenHash) {\n for (const session of sessions.values()) {\n if (session.tokenHash === tokenHash) return copy(session);\n }\n\n return null;\n },\n async listForAccount(accountId) {\n return [...sessions.values()]\n .filter((session) => session.accountId === accountId)\n .sort((a, b) => b.createdAt - a.createdAt)\n .map(copy);\n },\n async update(id, expectedVersion, patch) {\n const current = sessions.get(id);\n\n if (!current || current.version !== expectedVersion) return null;\n\n const next: DevtoolsSessionRecord = {\n ...current,\n ...copy(patch),\n id,\n accountId: current.accountId,\n version: current.version + 1,\n };\n\n sessions.set(id, next);\n\n return copy(next);\n },\n async remove(id) {\n return sessions.delete(id);\n },\n async removeForAccount(accountId, exceptId) {\n let removed = 0;\n\n for (const session of [...sessions.values()]) {\n if (session.accountId === accountId && session.id !== exceptId) {\n sessions.delete(session.id);\n removed++;\n }\n }\n\n return removed;\n },\n async removeExpired(at) {\n let removed = 0;\n\n for (const session of [...sessions.values()]) {\n if (session.expiresAt < at) {\n sessions.delete(session.id);\n removed++;\n }\n }\n\n return removed;\n },\n },\n\n invites: {\n async create(input) {\n const record: DevtoolsInviteRecord = {\n ...copy(input),\n id: randomUUID(),\n usedAt: null,\n accountId: null,\n };\n\n invites.set(record.id, record);\n\n return copy(record);\n },\n async findByTokenHash(tokenHash) {\n for (const invite of invites.values()) {\n if (invite.tokenHash === tokenHash) return copy(invite);\n }\n\n return null;\n },\n async list(listOptions = {}) {\n return [...invites.values()]\n .filter((invite) => listOptions.includeUsed === true || invite.usedAt === null)\n .sort((a, b) => b.createdAt - a.createdAt)\n .map(copy);\n },\n async markUsed(id, at, accountId) {\n const invite = invites.get(id);\n\n if (!invite || invite.usedAt !== null || at >= invite.expiresAt) return false;\n\n invites.set(id, { ...invite, usedAt: at, accountId });\n\n return true;\n },\n async remove(id) {\n return invites.delete(id);\n },\n async removeExpired(at) {\n let removed = 0;\n\n for (const invite of [...invites.values()]) {\n if (invite.usedAt === null && invite.expiresAt < at) {\n invites.delete(invite.id);\n removed++;\n }\n }\n\n return removed;\n },\n },\n\n audit: {\n async append(entry) {\n const record: DevtoolsAuditEntry = { ...copy(entry), id: randomUUID() };\n\n audit.push(record);\n\n return copy(record);\n },\n async list(filter) {\n const limit = Math.max(1, Math.min(500, filter.limit));\n\n return audit\n .filter(\n (entry) =>\n (filter.types === undefined || filter.types.includes(entry.type)) &&\n (filter.accountId === undefined || entry.accountId === filter.accountId) &&\n (filter.before === undefined || entry.at < filter.before),\n )\n .sort((a, b) => b.at - a.at)\n .slice(0, limit)\n .map(copy);\n },\n async count(filter) {\n return audit.filter(\n (entry) =>\n filter.types.includes(entry.type) &&\n entry.at >= filter.since &&\n (filter.accountId === undefined || entry.accountId === filter.accountId) &&\n (filter.ip === undefined ||\n (entry.ip !== null && rateLimitClient(entry.ip) === rateLimitClient(filter.ip))),\n ).length;\n },\n async prune(before) {\n const kept = audit.filter((entry) => entry.at >= before);\n const removed = audit.length - kept.length;\n\n audit.splice(0, audit.length, ...kept);\n\n return removed;\n },\n },\n\n state: {\n async read() {\n return copy(state ?? defaultStateRecord(now()));\n },\n async update(expectedVersion, patch) {\n const current = state ?? defaultStateRecord(now());\n\n if (current.version !== expectedVersion) return null;\n\n state = { ...current, ...copy(patch), updatedAt: now(), version: current.version + 1 };\n\n return copy(state);\n },\n },\n\n samples: {\n async insert(list) {\n for (const sample of list) samples.set(sample.id, copy(sample));\n },\n async list(filter) {\n const limit = Math.max(1, Math.min(1000, filter.limit));\n\n return [...samples.values()]\n .map((sample) => sample.summary)\n .filter((summary) => sampleMatches(summary, filter))\n .sort((a, b) => b.startedAt - a.startedAt)\n .slice(0, limit)\n .map(copy);\n },\n async get(id) {\n const sample = samples.get(id);\n\n return sample ? copy(sample) : null;\n },\n async prune(before) {\n let removed = 0;\n\n for (const sample of [...samples.values()]) {\n if (sample.startedAt < before) {\n samples.delete(sample.id);\n removed++;\n }\n }\n\n return removed;\n },\n async clear() {\n const removed = samples.size;\n\n samples.clear();\n\n return removed;\n },\n },\n\n reports: {\n async write(report) {\n reports.set(report.instance.id, copy(report));\n },\n async list(seenSince) {\n return [...reports.values()]\n .filter((report) => report.at >= seenSince)\n .sort((a, b) => b.at - a.at)\n .map(copy);\n },\n async prune(seenBefore) {\n let removed = 0;\n\n for (const report of [...reports.values()]) {\n if (report.at < seenBefore) {\n reports.delete(report.instance.id);\n removed++;\n }\n }\n\n return removed;\n },\n async remove(instanceId) {\n return reports.delete(instanceId);\n },\n },\n\n shares: {\n async create(input) {\n for (const share of shares.values()) {\n if (share.tokenHash === input.tokenHash) throw new DevtoolsStoreConflictError(\"tokenHash\");\n }\n\n const record: DevtoolsShareRecord = {\n ...copy(input),\n id: randomUUID(),\n revokedAt: null,\n lastUsedAt: null,\n uses: 0,\n };\n\n shares.set(record.id, record);\n\n return copy(record);\n },\n async findByTokenHash(tokenHash) {\n for (const share of shares.values()) {\n if (share.tokenHash === tokenHash) return copy(share);\n }\n\n return null;\n },\n async get(id) {\n const share = shares.get(id);\n\n return share ? copy(share) : null;\n },\n async list() {\n return [...shares.values()].sort((a, b) => b.createdAt - a.createdAt).map(copy);\n },\n async revoke(id, at) {\n const share = shares.get(id);\n\n if (!share || share.revokedAt !== null) return false;\n\n shares.set(id, { ...share, revokedAt: at });\n\n return true;\n },\n async revokeAll(at) {\n let revoked = 0;\n\n for (const share of [...shares.values()]) {\n if (share.revokedAt === null && share.expiresAt > at) {\n shares.set(share.id, { ...share, revokedAt: at });\n revoked++;\n }\n }\n\n return revoked;\n },\n async touch(id, at) {\n const share = shares.get(id);\n\n if (share) shares.set(id, { ...share, lastUsedAt: at, uses: share.uses + 1 });\n },\n async removeOld(before) {\n let removed = 0;\n\n for (const share of [...shares.values()]) {\n if (share.expiresAt < before || (share.revokedAt !== null && share.revokedAt < before)) {\n shares.delete(share.id);\n removed++;\n }\n }\n\n return removed;\n },\n },\n };\n}\n"],"mappings":";;;;;;AAoBA,SAAS,KAAQ,OAAa;CAC5B,OAAO,gBAAgB,KAAK;AAC9B;;AAGA,SAAgB,mBAAmB,MAAM,GAAwB;CAC/D,OAAO;EACL,UAAU;EACV,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,WAAW;EACX,SAAS;CACX;AACF;;AAGA,SAAgB,oBAAoB,QAAgB,QAAqC;CACvF,IAAI,WAAW,QAAW,OAAO;CAEjC,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,YAAY;CAExC,IAAI,YAAY,KAAK,KAAK,GAAG,O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AO;GACT;GACA,MAAM,MAAM,IAAI,IAAI;IAClB,MAAM,QAAQ,OAAO,IAAI,EAAE;IAE3B,IAAI,OAAO,OAAO,IAAI,IAAI;KAAE,GAAG;KAAO,YAAY;KAAI,MAAM,MAAM,OAAO;IAAE,CAAC;GAC9E;GACA,MAAM,UAAU,QAAQ;IACtB,IAAI,UAAU;IAEd,KAAK,MAAM,SAAS,CAAC,GAAG,OAAO,OAAO,CAAC,GACrC,IAAI,MAAM,YAAY,UAAW,MAAM,cAAc,QAAQ,MAAM,YAAY,QAAS;KACtF,OAAO,OAAO,MAAM,EAAE;KACtB;IACF;IAGF,OAAO;GACT;EACF;CACF;AACF"}
|
|
@@ -3,7 +3,8 @@ import { MigrationConstructor } from "@warlock.js/cascade";
|
|
|
3
3
|
/**
|
|
4
4
|
* The migrations of the production monitor's tables/collections:
|
|
5
5
|
* `devtools_accounts`, `devtools_sessions`, `devtools_invites`,
|
|
6
|
-
* `devtools_audit`, `devtools_state`, `devtools_samples`, `devtools_reports
|
|
6
|
+
* `devtools_audit`, `devtools_state`, `devtools_samples`, `devtools_reports`,
|
|
7
|
+
* `devtools_shares`.
|
|
7
8
|
* An app lists them in `warlock.config.ts > database.migrations`.
|
|
8
9
|
*/
|
|
9
10
|
export declare const devtoolsMigrations: readonly MigrationConstructor[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.mts","names":[],"sources":["../../../../../../../../../packages/devtools/src/production/store/migrations.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrations.d.mts","names":[],"sources":["../../../../../../../../../packages/devtools/src/production/store/migrations.ts"],"mappings":";;;;;;;;;qBAmBa,6BAA6B"}
|
|
@@ -4,6 +4,7 @@ import { DevtoolsInvitesMigration } from "./models/invite.migration.mjs";
|
|
|
4
4
|
import { DevtoolsReportsMigration } from "./models/report.migration.mjs";
|
|
5
5
|
import { DevtoolsSamplesMigration } from "./models/sample.migration.mjs";
|
|
6
6
|
import { DevtoolsSessionsMigration } from "./models/session.migration.mjs";
|
|
7
|
+
import { DevtoolsSharesMigration } from "./models/share.migration.mjs";
|
|
7
8
|
import { DevtoolsStateMigration } from "./models/state.migration.mjs";
|
|
8
9
|
import "./models/index.mjs";
|
|
9
10
|
|
|
@@ -11,7 +12,8 @@ import "./models/index.mjs";
|
|
|
11
12
|
/**
|
|
12
13
|
* The migrations of the production monitor's tables/collections:
|
|
13
14
|
* `devtools_accounts`, `devtools_sessions`, `devtools_invites`,
|
|
14
|
-
* `devtools_audit`, `devtools_state`, `devtools_samples`, `devtools_reports
|
|
15
|
+
* `devtools_audit`, `devtools_state`, `devtools_samples`, `devtools_reports`,
|
|
16
|
+
* `devtools_shares`.
|
|
15
17
|
* An app lists them in `warlock.config.ts > database.migrations`.
|
|
16
18
|
*/
|
|
17
19
|
const devtoolsMigrations = [
|
|
@@ -21,7 +23,8 @@ const devtoolsMigrations = [
|
|
|
21
23
|
DevtoolsAuditMigration,
|
|
22
24
|
DevtoolsStateMigration,
|
|
23
25
|
DevtoolsSamplesMigration,
|
|
24
|
-
DevtoolsReportsMigration
|
|
26
|
+
DevtoolsReportsMigration,
|
|
27
|
+
DevtoolsSharesMigration
|
|
25
28
|
];
|
|
26
29
|
|
|
27
30
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.mjs","names":[],"sources":["../../../../../../../../../packages/devtools/src/production/store/migrations.ts"],"sourcesContent":["import type { MigrationConstructor } from \"@warlock.js/cascade\";\nimport {\n DevtoolsAccountsMigration,\n DevtoolsAuditMigration,\n DevtoolsInvitesMigration,\n DevtoolsReportsMigration,\n DevtoolsSamplesMigration,\n DevtoolsSessionsMigration,\n DevtoolsStateMigration,\n} from \"./models\";\n\n/**\n * The migrations of the production monitor's tables/collections:\n * `devtools_accounts`, `devtools_sessions`, `devtools_invites`,\n * `devtools_audit`, `devtools_state`, `devtools_samples`, `devtools_reports`.\n * An app lists them in `warlock.config.ts > database.migrations`.\n */\nexport const devtoolsMigrations: readonly MigrationConstructor[] = [\n DevtoolsAccountsMigration,\n DevtoolsSessionsMigration,\n DevtoolsInvitesMigration,\n DevtoolsAuditMigration,\n DevtoolsStateMigration,\n DevtoolsSamplesMigration,\n DevtoolsReportsMigration,\n];\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrations.mjs","names":[],"sources":["../../../../../../../../../packages/devtools/src/production/store/migrations.ts"],"sourcesContent":["import type { MigrationConstructor } from \"@warlock.js/cascade\";\nimport {\n DevtoolsAccountsMigration,\n DevtoolsAuditMigration,\n DevtoolsInvitesMigration,\n DevtoolsReportsMigration,\n DevtoolsSamplesMigration,\n DevtoolsSessionsMigration,\n DevtoolsSharesMigration,\n DevtoolsStateMigration,\n} from \"./models\";\n\n/**\n * The migrations of the production monitor's tables/collections:\n * `devtools_accounts`, `devtools_sessions`, `devtools_invites`,\n * `devtools_audit`, `devtools_state`, `devtools_samples`, `devtools_reports`,\n * `devtools_shares`.\n * An app lists them in `warlock.config.ts > database.migrations`.\n */\nexport const devtoolsMigrations: readonly MigrationConstructor[] = [\n DevtoolsAccountsMigration,\n DevtoolsSessionsMigration,\n DevtoolsInvitesMigration,\n DevtoolsAuditMigration,\n DevtoolsStateMigration,\n DevtoolsSamplesMigration,\n DevtoolsReportsMigration,\n DevtoolsSharesMigration,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAa,qBAAsD;CACjE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -11,7 +11,9 @@ import { DevtoolsSampleRow } from "./sample.model.mjs";
|
|
|
11
11
|
import { DevtoolsSamplesMigration } from "./sample.migration.mjs";
|
|
12
12
|
import { DevtoolsSessionRow } from "./session.model.mjs";
|
|
13
13
|
import { DevtoolsSessionsMigration } from "./session.migration.mjs";
|
|
14
|
+
import { DevtoolsShareRow } from "./share.model.mjs";
|
|
15
|
+
import { DevtoolsSharesMigration } from "./share.migration.mjs";
|
|
14
16
|
import { DevtoolsStateRow } from "./state.model.mjs";
|
|
15
17
|
import { DevtoolsStateMigration } from "./state.migration.mjs";
|
|
16
18
|
|
|
17
|
-
export { DevtoolsAccountRow, DevtoolsAccountsMigration, DevtoolsAuditMigration, DevtoolsAuditRow, DevtoolsInviteRow, DevtoolsInvitesMigration, DevtoolsReportRow, DevtoolsReportsMigration, DevtoolsRowModel, DevtoolsSampleRow, DevtoolsSamplesMigration, DevtoolsSessionRow, DevtoolsSessionsMigration, DevtoolsStateMigration, DevtoolsStateRow };
|
|
19
|
+
export { DevtoolsAccountRow, DevtoolsAccountsMigration, DevtoolsAuditMigration, DevtoolsAuditRow, DevtoolsInviteRow, DevtoolsInvitesMigration, DevtoolsReportRow, DevtoolsReportsMigration, DevtoolsRowModel, DevtoolsSampleRow, DevtoolsSamplesMigration, DevtoolsSessionRow, DevtoolsSessionsMigration, DevtoolsShareRow, DevtoolsSharesMigration, DevtoolsStateMigration, DevtoolsStateRow };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DevtoolsShareRow } from "./share.model.mjs";
|
|
2
|
+
import { migrate } from "@warlock.js/cascade";
|
|
3
|
+
|
|
4
|
+
//#region ../../packages/devtools/src/production/store/models/share.migration.ts
|
|
5
|
+
const DevtoolsSharesMigration = migrate(DevtoolsShareRow, {
|
|
6
|
+
name: "devtoolsShares",
|
|
7
|
+
up() {
|
|
8
|
+
this.createTableIfNotExists();
|
|
9
|
+
this.string("id", 64).primary().unique();
|
|
10
|
+
this.string("token_hash", 64).unique();
|
|
11
|
+
this.string("panel", 64);
|
|
12
|
+
this.string("label", 80);
|
|
13
|
+
this.string("created_by", 64).nullable();
|
|
14
|
+
this.bigInteger("created_at");
|
|
15
|
+
this.bigInteger("expires_at").index();
|
|
16
|
+
this.bigInteger("revoked_at").nullable();
|
|
17
|
+
this.bigInteger("last_used_at").nullable();
|
|
18
|
+
this.integer("uses").default(0);
|
|
19
|
+
},
|
|
20
|
+
down() {
|
|
21
|
+
this.dropTableIfExists();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { DevtoolsSharesMigration };
|
|
27
|
+
//# sourceMappingURL=share.migration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.migration.mjs","names":[],"sources":["../../../../../../../../../../packages/devtools/src/production/store/models/share.migration.ts"],"sourcesContent":["import { migrate } from \"@warlock.js/cascade\";\nimport { DevtoolsShareRow } from \"./share.model\";\n\nexport const DevtoolsSharesMigration = migrate(DevtoolsShareRow, {\n name: \"devtoolsShares\",\n up() {\n this.createTableIfNotExists();\n\n // The id is a string the store supplies; `unique` also covers MongoDB,\n // which ignores primary keys.\n this.string(\"id\", 64).primary().unique();\n\n this.string(\"token_hash\", 64).unique();\n this.string(\"panel\", 64);\n this.string(\"label\", 80);\n this.string(\"created_by\", 64).nullable();\n this.bigInteger(\"created_at\");\n this.bigInteger(\"expires_at\").index();\n this.bigInteger(\"revoked_at\").nullable();\n this.bigInteger(\"last_used_at\").nullable();\n this.integer(\"uses\").default(0);\n },\n down() {\n this.dropTableIfExists();\n },\n});\n"],"mappings":";;;;AAGA,MAAa,0BAA0B,QAAQ,kBAAkB;CAC/D,MAAM;CACN,KAAK;EACH,KAAK,uBAAuB;EAI5B,KAAK,OAAO,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;EAEvC,KAAK,OAAO,cAAc,EAAE,CAAC,CAAC,OAAO;EACrC,KAAK,OAAO,SAAS,EAAE;EACvB,KAAK,OAAO,SAAS,EAAE;EACvB,KAAK,OAAO,cAAc,EAAE,CAAC,CAAC,SAAS;EACvC,KAAK,WAAW,YAAY;EAC5B,KAAK,WAAW,YAAY,CAAC,CAAC,MAAM;EACpC,KAAK,WAAW,YAAY,CAAC,CAAC,SAAS;EACvC,KAAK,WAAW,cAAc,CAAC,CAAC,SAAS;EACzC,KAAK,QAAQ,MAAM,CAAC,CAAC,QAAQ,CAAC;CAChC;CACA,OAAO;EACL,KAAK,kBAAkB;CACzB;AACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DevtoolsRowModel } from "./base.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/devtools/src/production/store/models/share.model.ts
|
|
4
|
+
/** A row of `devtools_shares`. */
|
|
5
|
+
var DevtoolsShareRow = class extends DevtoolsRowModel {
|
|
6
|
+
static {
|
|
7
|
+
this.table = "devtools_shares";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { DevtoolsShareRow };
|
|
13
|
+
//# sourceMappingURL=share.model.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.model.mjs","names":[],"sources":["../../../../../../../../../../packages/devtools/src/production/store/models/share.model.ts"],"sourcesContent":["import { DevtoolsRowModel } from \"./base\";\n\n/** A row of `devtools_shares`. */\nexport class DevtoolsShareRow extends DevtoolsRowModel {\n public static table = \"devtools_shares\";\n}\n"],"mappings":";;;;AAGA,IAAa,mBAAb,cAAsC,iBAAiB;;eAC/B;;AACxB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { realpath, stat } from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
//#region ../../packages/devtools/src/server/panel-files.ts
|
|
5
|
+
/** The longest request path a panel's file route looks at. */
|
|
6
|
+
const MAX_PATH_LENGTH = 512;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves a request path inside a panel's folder of images, or `null` when
|
|
9
|
+
* it must answer 404. The path is the one URL decoding left (decoded once);
|
|
10
|
+
* it is refused when it is empty, absolute, has an empty, `.` or `..`
|
|
11
|
+
* segment, a backslash, a colon or a NUL byte, or an extension the panel did
|
|
12
|
+
* not list. The resolved file must be a regular file whose real path (links
|
|
13
|
+
* followed) stays inside the real path of the folder.
|
|
14
|
+
*/
|
|
15
|
+
async function resolvePanelFile(files, requested) {
|
|
16
|
+
if (typeof requested !== "string" || requested === "" || requested.length > MAX_PATH_LENGTH) return null;
|
|
17
|
+
if (/[\0\\:]/.test(requested) || requested.startsWith("/")) return null;
|
|
18
|
+
const segments = requested.split("/");
|
|
19
|
+
if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) return null;
|
|
20
|
+
const extension = path.extname(segments[segments.length - 1] ?? "").toLowerCase();
|
|
21
|
+
if (!files.extensions.includes(extension)) return null;
|
|
22
|
+
try {
|
|
23
|
+
const root = await realpath(files.dir);
|
|
24
|
+
const real = await realpath(path.join(root, ...segments));
|
|
25
|
+
if (!real.startsWith(root.endsWith(path.sep) ? root : root + path.sep)) return null;
|
|
26
|
+
if (!files.extensions.includes(path.extname(real).toLowerCase())) return null;
|
|
27
|
+
return (await stat(real)).isFile() ? real : null;
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { resolvePanelFile };
|
|
35
|
+
//# sourceMappingURL=panel-files.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-files.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/server/panel-files.ts"],"sourcesContent":["import { realpath, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { MountedPanelFiles } from \"../panels\";\n\n/** The longest request path a panel's file route looks at. */\nconst MAX_PATH_LENGTH = 512;\n\n/**\n * Resolves a request path inside a panel's folder of images, or `null` when\n * it must answer 404. The path is the one URL decoding left (decoded once);\n * it is refused when it is empty, absolute, has an empty, `.` or `..`\n * segment, a backslash, a colon or a NUL byte, or an extension the panel did\n * not list. The resolved file must be a regular file whose real path (links\n * followed) stays inside the real path of the folder.\n */\nexport async function resolvePanelFile(\n files: MountedPanelFiles,\n requested: unknown,\n): Promise<string | null> {\n if (typeof requested !== \"string\" || requested === \"\" || requested.length > MAX_PATH_LENGTH) {\n return null;\n }\n\n if (/[\\0\\\\:]/.test(requested) || requested.startsWith(\"/\")) return null;\n\n const segments = requested.split(\"/\");\n\n if (segments.some((segment) => segment === \"\" || segment === \".\" || segment === \"..\")) {\n return null;\n }\n\n const extension = path.extname(segments[segments.length - 1] ?? \"\").toLowerCase();\n\n if (!files.extensions.includes(extension)) return null;\n\n try {\n const root = await realpath(files.dir);\n const real = await realpath(path.join(root, ...segments));\n\n if (!real.startsWith(root.endsWith(path.sep) ? root : root + path.sep)) return null;\n\n // A link inside the folder must not turn an image name into another kind of file.\n if (!files.extensions.includes(path.extname(real).toLowerCase())) return null;\n\n return (await stat(real)).isFile() ? real : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;AAKA,MAAM,kBAAkB;;;;;;;;;AAUxB,eAAsB,iBACpB,OACA,WACwB;CACxB,IAAI,OAAO,cAAc,YAAY,cAAc,MAAM,UAAU,SAAS,iBAC1E,OAAO;CAGT,IAAI,UAAU,KAAK,SAAS,KAAK,UAAU,WAAW,GAAG,GAAG,OAAO;CAEnE,MAAM,WAAW,UAAU,MAAM,GAAG;CAEpC,IAAI,SAAS,MAAM,YAAY,YAAY,MAAM,YAAY,OAAO,YAAY,IAAI,GAClF,OAAO;CAGT,MAAM,YAAY,KAAK,QAAQ,SAAS,SAAS,SAAS,MAAM,EAAE,CAAC,CAAC,YAAY;CAEhF,IAAI,CAAC,MAAM,WAAW,SAAS,SAAS,GAAG,OAAO;CAElD,IAAI;EACF,MAAM,OAAO,MAAM,SAAS,MAAM,GAAG;EACrC,MAAM,OAAO,MAAM,SAAS,KAAK,KAAK,MAAM,GAAG,QAAQ,CAAC;EAExD,IAAI,CAAC,KAAK,WAAW,KAAK,SAAS,KAAK,GAAG,IAAI,OAAO,OAAO,KAAK,GAAG,GAAG,OAAO;EAG/E,IAAI,CAAC,MAAM,WAAW,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,OAAO;EAEzE,QAAQ,MAAM,KAAK,IAAI,EAAC,CAAE,OAAO,IAAI,OAAO;CAC9C,QAAQ;EACN,OAAO;CACT;AACF"}
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import { panelContentType } from "../panels.mjs";
|
|
2
2
|
import { sendFile } from "./ui-assets.mjs";
|
|
3
|
+
import { resolvePanelFile } from "./panel-files.mjs";
|
|
4
|
+
import { createReadStream } from "node:fs";
|
|
3
5
|
|
|
4
6
|
//#region ../../packages/devtools/src/server/panel-routes.ts
|
|
7
|
+
/** Sends one image of a panel's folder with its content type, or answers 404. */
|
|
8
|
+
async function sendPanelFile(panel, requested, request, reply, notFound) {
|
|
9
|
+
const file = panel.files === null ? null : await resolvePanelFile(panel.files, requested);
|
|
10
|
+
if (file === null) return notFound(request, reply);
|
|
11
|
+
reply.header("X-Content-Type-Options", "nosniff").header("Cache-Control", "no-store").header("Content-Type", panelContentType(file));
|
|
12
|
+
return reply.send(createReadStream(file));
|
|
13
|
+
}
|
|
5
14
|
/**
|
|
6
|
-
* Mounts each panel's data routes at `/api/<id><route path
|
|
7
|
-
* module and assets at `/panels/<id>/<name
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
15
|
+
* Mounts each panel's data routes at `/api/<id><route path>`, its view
|
|
16
|
+
* module and assets at `/panels/<id>/<name>`, and its folder of images at
|
|
17
|
+
* `/panels/<id>/files/<path>`. Callers register this inside the devtools
|
|
18
|
+
* scope, so the guard covers every one of them. A file is served only when
|
|
19
|
+
* its name is listed by the panel (or, for `files`, resolves inside the
|
|
20
|
+
* panel's folder with a listed extension); the request never becomes a
|
|
21
|
+
* filesystem path on its own.
|
|
11
22
|
*/
|
|
12
|
-
function registerPanelRoutes(server, panels) {
|
|
23
|
+
function registerPanelRoutes(server, panels, options = {}) {
|
|
13
24
|
const byId = new Map(panels.map((panel) => [panel.id, panel]));
|
|
25
|
+
const notFound = options.notFound ?? ((_request, reply) => {
|
|
26
|
+
reply.code(404).header("Cache-Control", "no-store").send();
|
|
27
|
+
return reply;
|
|
28
|
+
});
|
|
14
29
|
for (const panel of panels) for (const route of panel.routes) server.route({
|
|
15
30
|
method: route.method,
|
|
16
31
|
url: `/api/${panel.id}${route.path}`,
|
|
@@ -26,6 +41,11 @@ function registerPanelRoutes(server, panels) {
|
|
|
26
41
|
return result;
|
|
27
42
|
}
|
|
28
43
|
});
|
|
44
|
+
server.get("/panels/:id/files/*", async (request, reply) => {
|
|
45
|
+
const panel = byId.get(request.params.id);
|
|
46
|
+
if (panel === void 0) return notFound(request, reply);
|
|
47
|
+
return sendPanelFile(panel, request.params["*"], request, reply, notFound);
|
|
48
|
+
});
|
|
29
49
|
server.get("/panels/:id/:name", (request, reply) => {
|
|
30
50
|
const panel = byId.get(request.params.id);
|
|
31
51
|
const name = request.params.name;
|
|
@@ -40,5 +60,5 @@ function registerPanelRoutes(server, panels) {
|
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
//#endregion
|
|
43
|
-
export { registerPanelRoutes };
|
|
63
|
+
export { registerPanelRoutes, sendPanelFile };
|
|
44
64
|
//# sourceMappingURL=panel-routes.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel-routes.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/server/panel-routes.ts"],"sourcesContent":["import type { FastifyInstance } from \"fastify\";\nimport { type MountedDevtoolsPanel, panelContentType } from \"../panels\";\nimport type { DevtoolsPanelRequest } from \"../types\";\nimport { sendFile } from \"./ui-assets\";\n\n/**\n * Mounts each panel's data routes at `/api/<id><route path
|
|
1
|
+
{"version":3,"file":"panel-routes.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/server/panel-routes.ts"],"sourcesContent":["import { createReadStream } from \"node:fs\";\nimport type { FastifyInstance, FastifyReply, FastifyRequest } from \"fastify\";\nimport { type MountedDevtoolsPanel, panelContentType } from \"../panels\";\nimport type { DevtoolsPanelRequest } from \"../types\";\nimport { resolvePanelFile } from \"./panel-files\";\nimport { sendFile } from \"./ui-assets\";\n\n/** Answers 404; the production mount passes its uniform not-found answer. */\nexport type PanelNotFound = (request: FastifyRequest, reply: FastifyReply) => FastifyReply;\n\n/** Sends one image of a panel's folder with its content type, or answers 404. */\nexport async function sendPanelFile(\n panel: Pick<MountedDevtoolsPanel, \"files\">,\n requested: unknown,\n request: FastifyRequest,\n reply: FastifyReply,\n notFound: PanelNotFound,\n): Promise<FastifyReply | void> {\n const file = panel.files === null ? null : await resolvePanelFile(panel.files, requested);\n\n if (file === null) return notFound(request, reply);\n\n reply\n .header(\"X-Content-Type-Options\", \"nosniff\")\n .header(\"Cache-Control\", \"no-store\")\n .header(\"Content-Type\", panelContentType(file));\n\n return reply.send(createReadStream(file));\n}\n\n/**\n * Mounts each panel's data routes at `/api/<id><route path>`, its view\n * module and assets at `/panels/<id>/<name>`, and its folder of images at\n * `/panels/<id>/files/<path>`. Callers register this inside the devtools\n * scope, so the guard covers every one of them. A file is served only when\n * its name is listed by the panel (or, for `files`, resolves inside the\n * panel's folder with a listed extension); the request never becomes a\n * filesystem path on its own.\n */\nexport function registerPanelRoutes(\n server: FastifyInstance,\n panels: readonly MountedDevtoolsPanel[],\n options: { notFound?: PanelNotFound } = {},\n): void {\n const byId = new Map(panels.map((panel) => [panel.id, panel]));\n const notFound: PanelNotFound =\n options.notFound ??\n ((_request, reply) => {\n reply.code(404).header(\"Cache-Control\", \"no-store\").send();\n\n return reply;\n });\n\n for (const panel of panels) {\n for (const route of panel.routes) {\n server.route({\n method: route.method,\n url: `/api/${panel.id}${route.path}`,\n handler: async (request, reply) => {\n const input: DevtoolsPanelRequest = {\n params: (request.params ?? {}) as Record<string, string>,\n query: (request.query ?? {}) as Record<string, string | string[]>,\n body: request.body,\n };\n const result = await route.handler(input);\n\n reply.header(\"cache-control\", \"no-store\");\n\n if (result === undefined) return reply.code(204).send();\n\n return result;\n },\n });\n }\n }\n\n server.get<{ Params: { id: string; \"*\": string } }>(\n \"/panels/:id/files/*\",\n async (request, reply) => {\n const panel = byId.get(request.params.id);\n\n if (panel === undefined) return notFound(request, reply);\n\n return sendPanelFile(panel, request.params[\"*\"], request, reply, notFound);\n },\n );\n\n server.get<{ Params: { id: string; name: string } }>(\"/panels/:id/:name\", (request, reply) => {\n const panel = byId.get(request.params.id);\n const name = request.params.name;\n const file =\n panel === undefined\n ? undefined\n : name === \"view.js\"\n ? panel.view\n : Object.hasOwn(panel.assets, name)\n ? panel.assets[name]\n : undefined;\n\n if (file === undefined) {\n reply.code(404).header(\"Cache-Control\", \"no-store\").send();\n return;\n }\n\n reply.header(\"X-Content-Type-Options\", \"nosniff\");\n sendFile(reply, file, panelContentType(name));\n });\n}\n"],"mappings":";;;;;;;AAWA,eAAsB,cACpB,OACA,WACA,SACA,OACA,UAC8B;CAC9B,MAAM,OAAO,MAAM,UAAU,OAAO,OAAO,MAAM,iBAAiB,MAAM,OAAO,SAAS;CAExF,IAAI,SAAS,MAAM,OAAO,SAAS,SAAS,KAAK;CAEjD,MACG,OAAO,0BAA0B,SAAS,CAAC,CAC3C,OAAO,iBAAiB,UAAU,CAAC,CACnC,OAAO,gBAAgB,iBAAiB,IAAI,CAAC;CAEhD,OAAO,MAAM,KAAK,iBAAiB,IAAI,CAAC;AAC1C;;;;;;;;;;AAWA,SAAgB,oBACd,QACA,QACA,UAAwC,CAAC,GACnC;CACN,MAAM,OAAO,IAAI,IAAI,OAAO,KAAK,UAAU,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;CAC7D,MAAM,WACJ,QAAQ,cACN,UAAU,UAAU;EACpB,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,iBAAiB,UAAU,CAAC,CAAC,KAAK;EAEzD,OAAO;CACT;CAEF,KAAK,MAAM,SAAS,QAClB,KAAK,MAAM,SAAS,MAAM,QACxB,OAAO,MAAM;EACX,QAAQ,MAAM;EACd,KAAK,QAAQ,MAAM,KAAK,MAAM;EAC9B,SAAS,OAAO,SAAS,UAAU;GACjC,MAAM,QAA8B;IAClC,QAAS,QAAQ,UAAU,CAAC;IAC5B,OAAQ,QAAQ,SAAS,CAAC;IAC1B,MAAM,QAAQ;GAChB;GACA,MAAM,SAAS,MAAM,MAAM,QAAQ,KAAK;GAExC,MAAM,OAAO,iBAAiB,UAAU;GAExC,IAAI,WAAW,QAAW,OAAO,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK;GAEtD,OAAO;EACT;CACF,CAAC;CAIL,OAAO,IACL,uBACA,OAAO,SAAS,UAAU;EACxB,MAAM,QAAQ,KAAK,IAAI,QAAQ,OAAO,EAAE;EAExC,IAAI,UAAU,QAAW,OAAO,SAAS,SAAS,KAAK;EAEvD,OAAO,cAAc,OAAO,QAAQ,OAAO,MAAM,SAAS,OAAO,QAAQ;CAC3E,CACF;CAEA,OAAO,IAA8C,sBAAsB,SAAS,UAAU;EAC5F,MAAM,QAAQ,KAAK,IAAI,QAAQ,OAAO,EAAE;EACxC,MAAM,OAAO,QAAQ,OAAO;EAC5B,MAAM,OACJ,UAAU,SACN,SACA,SAAS,YACP,MAAM,OACN,OAAO,OAAO,MAAM,QAAQ,IAAI,IAC9B,MAAM,OAAO,QACb;EAEV,IAAI,SAAS,QAAW;GACtB,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,iBAAiB,UAAU,CAAC,CAAC,KAAK;GACzD;EACF;EAEA,MAAM,OAAO,0BAA0B,SAAS;EAChD,SAAS,OAAO,MAAM,iBAAiB,IAAI,CAAC;CAC9C,CAAC;AACH"}
|
|
@@ -14,7 +14,8 @@ function developmentSessionView(deps) {
|
|
|
14
14
|
csrf: null,
|
|
15
15
|
expiresAt: null,
|
|
16
16
|
instance: deps.instance ?? null,
|
|
17
|
-
methods: null
|
|
17
|
+
methods: null,
|
|
18
|
+
share: null
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
/** The tabs `GET api/panels` lists: the built-in tabs in `deps.builtInPanels` (default all), then the package panels. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-routes.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/server/session-routes.ts"],"sourcesContent":["import type { FastifyInstance } from \"fastify\";\nimport { listPanelInfos, type MountedDevtoolsPanel } from \"../panels\";\nimport type { DevtoolsPanelInfo, DevtoolsSessionView } from \"../production/contracts\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\n/**\n * The session view of the development dashboard: there are no accounts, the\n * loopback guard is the access control, and the visitor is an admin.\n */\nexport function developmentSessionView(deps: MountDevtoolsRoutesDeps): DevtoolsSessionView {\n return {\n mode: \"development\",\n stage: \"active\",\n account: null,\n role: \"admin\",\n csrf: null,\n expiresAt: null,\n instance: deps.instance ?? null,\n methods: null,\n };\n}\n\n/** The tabs `GET api/panels` lists: the built-in tabs in `deps.builtInPanels` (default all), then the package panels. */\nexport function panelInfos(\n deps: MountDevtoolsRoutesDeps,\n panels: readonly Pick<MountedDevtoolsPanel, \"id\" | \"title\">[],\n): DevtoolsPanelInfo[] {\n return listPanelInfos(panels, deps.builtInPanels);\n}\n\n/**\n * Registers `GET /api/auth/session` (the development view: signed in as an\n * admin, no accounts) and `GET /api/panels`, so the same dashboard shell\n * works in both modes. Production answers these from its own mount.\n */\nexport function registerSessionRoutes(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n panels: readonly MountedDevtoolsPanel[],\n): void {\n server.get(\"/api/auth/session\", async (_request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n\n return developmentSessionView(deps);\n });\n\n server.get(\"/api/panels\", async (_request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n\n return panelInfos(deps, panels);\n });\n}\n"],"mappings":";;;;;;;AASA,SAAgB,uBAAuB,MAAoD;CACzF,OAAO;EACL,MAAM;EACN,OAAO;EACP,SAAS;EACT,MAAM;EACN,MAAM;EACN,WAAW;EACX,UAAU,KAAK,YAAY;EAC3B,SAAS;
|
|
1
|
+
{"version":3,"file":"session-routes.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/server/session-routes.ts"],"sourcesContent":["import type { FastifyInstance } from \"fastify\";\nimport { listPanelInfos, type MountedDevtoolsPanel } from \"../panels\";\nimport type { DevtoolsPanelInfo, DevtoolsSessionView } from \"../production/contracts\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\n/**\n * The session view of the development dashboard: there are no accounts, the\n * loopback guard is the access control, and the visitor is an admin.\n */\nexport function developmentSessionView(deps: MountDevtoolsRoutesDeps): DevtoolsSessionView {\n return {\n mode: \"development\",\n stage: \"active\",\n account: null,\n role: \"admin\",\n csrf: null,\n expiresAt: null,\n instance: deps.instance ?? null,\n methods: null,\n share: null,\n };\n}\n\n/** The tabs `GET api/panels` lists: the built-in tabs in `deps.builtInPanels` (default all), then the package panels. */\nexport function panelInfos(\n deps: MountDevtoolsRoutesDeps,\n panels: readonly (Pick<MountedDevtoolsPanel, \"id\" | \"title\"> &\n Partial<Pick<MountedDevtoolsPanel, \"share\">>)[],\n): DevtoolsPanelInfo[] {\n return listPanelInfos(panels, deps.builtInPanels);\n}\n\n/**\n * Registers `GET /api/auth/session` (the development view: signed in as an\n * admin, no accounts) and `GET /api/panels`, so the same dashboard shell\n * works in both modes. Production answers these from its own mount.\n */\nexport function registerSessionRoutes(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n panels: readonly MountedDevtoolsPanel[],\n): void {\n server.get(\"/api/auth/session\", async (_request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n\n return developmentSessionView(deps);\n });\n\n server.get(\"/api/panels\", async (_request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n\n return panelInfos(deps, panels);\n });\n}\n"],"mappings":";;;;;;;AASA,SAAgB,uBAAuB,MAAoD;CACzF,OAAO;EACL,MAAM;EACN,OAAO;EACP,SAAS;EACT,MAAM;EACN,MAAM;EACN,WAAW;EACX,UAAU,KAAK,YAAY;EAC3B,SAAS;EACT,OAAO;CACT;AACF;;AAGA,SAAgB,WACd,MACA,QAEqB;CACrB,OAAO,eAAe,QAAQ,KAAK,aAAa;AAClD;;;;;;AAOA,SAAgB,sBACd,QACA,MACA,QACM;CACN,OAAO,IAAI,qBAAqB,OAAO,UAAU,UAAU;EACzD,MAAM,OAAO,iBAAiB,UAAU;EAExC,OAAO,uBAAuB,IAAI;CACpC,CAAC;CAED,OAAO,IAAI,eAAe,OAAO,UAAU,UAAU;EACnD,MAAM,OAAO,iBAAiB,UAAU;EAExC,OAAO,WAAW,MAAM,MAAM;CAChC,CAAC;AACH"}
|
package/esm/types.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DevtoolsAgentTraceEvent } from "./sources/agent-trace-source.mjs";
|
|
2
2
|
import { DevtoolsAiEvent } from "./sources/ai-source.mjs";
|
|
3
|
-
import { DEVTOOLS_BUILT_IN_PANELS, DEVTOOLS_FAILURE_AUDIT_TYPES, DEVTOOLS_LATENCY_BUCKETS_MS, DevtoolsAccountView, DevtoolsApiErrorBody, DevtoolsAuditEntry, DevtoolsAuditType, DevtoolsAuthStepResult, DevtoolsBuiltInPanelId, DevtoolsCaptureCounters, DevtoolsCreatedInvite, DevtoolsErrorCode, DevtoolsErrorGroup, DevtoolsErrorsView, DevtoolsExplainResult, DevtoolsHealthReport, DevtoolsHealthView, DevtoolsHistogram, DevtoolsInstanceInfo, DevtoolsInstanceReport, DevtoolsInstancesView, DevtoolsInviteView, DevtoolsJobsReport, DevtoolsJobsView, DevtoolsLogRow, DevtoolsLoginInput, DevtoolsLogsView, DevtoolsMode, DevtoolsPanelInfo, DevtoolsPasswordSource, DevtoolsQueryShapeRow, DevtoolsQueryShapeStats, DevtoolsQueryStatsView, DevtoolsRecoveryCodes, DevtoolsReportLogEntry, DevtoolsResourcePoint, DevtoolsResourceSnapshot, DevtoolsResourcesView, DevtoolsRole, DevtoolsRoutePhaseStats, DevtoolsRouteStats, DevtoolsRouteStatsRow, DevtoolsRouteStatsView, DevtoolsSampleDetail, DevtoolsSampleQuery, DevtoolsSampleSummary, DevtoolsScheduleInfo, DevtoolsSessionInfo, DevtoolsSessionStage, DevtoolsSessionView, DevtoolsTotpEnrolment, DevtoolsUserListView } from "./production/contracts.mjs";
|
|
3
|
+
import { DEVTOOLS_BUILT_IN_PANELS, DEVTOOLS_FAILURE_AUDIT_TYPES, DEVTOOLS_LATENCY_BUCKETS_MS, DEVTOOLS_SHARE_LABEL_MAX, DevtoolsAccountView, DevtoolsApiErrorBody, DevtoolsAuditEntry, DevtoolsAuditType, DevtoolsAuthStepResult, DevtoolsBuiltInPanelId, DevtoolsCaptureCounters, DevtoolsCreatedInvite, DevtoolsCreatedShare, DevtoolsErrorCode, DevtoolsErrorGroup, DevtoolsErrorsView, DevtoolsExplainResult, DevtoolsHealthReport, DevtoolsHealthView, DevtoolsHistogram, DevtoolsInstanceInfo, DevtoolsInstanceReport, DevtoolsInstancesView, DevtoolsInviteView, DevtoolsJobsReport, DevtoolsJobsView, DevtoolsLogRow, DevtoolsLoginInput, DevtoolsLogsView, DevtoolsMode, DevtoolsPanelInfo, DevtoolsPasswordSource, DevtoolsQueryShapeRow, DevtoolsQueryShapeStats, DevtoolsQueryStatsView, DevtoolsRecoveryCodes, DevtoolsReportLogEntry, DevtoolsResourcePoint, DevtoolsResourceSnapshot, DevtoolsResourcesView, DevtoolsRole, DevtoolsRoutePhaseStats, DevtoolsRouteStats, DevtoolsRouteStatsRow, DevtoolsRouteStatsView, DevtoolsSampleDetail, DevtoolsSampleQuery, DevtoolsSampleSummary, DevtoolsScheduleInfo, DevtoolsSessionInfo, DevtoolsSessionStage, DevtoolsSessionView, DevtoolsShareCreateInput, DevtoolsShareList, DevtoolsShareOpenAnswer, DevtoolsShareStatus, DevtoolsShareView, DevtoolsTotpEnrolment, DevtoolsUserListView } from "./production/contracts.mjs";
|
|
4
4
|
import { RequestLogRecord } from "@warlock.js/core";
|
|
5
5
|
//#region ../../packages/devtools/src/types.d.ts
|
|
6
6
|
/**
|
|
@@ -236,6 +236,18 @@ export type DevtoolsProductionOptions = {
|
|
|
236
236
|
/** The WebAuthn relying party id. @default the host of `origin`, else of the request */
|
|
237
237
|
rpId?: string;
|
|
238
238
|
};
|
|
239
|
+
/**
|
|
240
|
+
* Read-only share links: an admin creates a link to a panel that declares
|
|
241
|
+
* `share` (the Grimoire product map), and anyone holding the link sees that
|
|
242
|
+
* view without an account. Off unless `enabled` is `true`. Needs the
|
|
243
|
+
* `devtools_shares` table (in `devtoolsMigrations`).
|
|
244
|
+
*/
|
|
245
|
+
share?: {
|
|
246
|
+
/** @default false */
|
|
247
|
+
enabled?: boolean;
|
|
248
|
+
/** The longest life an admin may give a link, in days (1–365). @default 30 */
|
|
249
|
+
maxDays?: number;
|
|
250
|
+
};
|
|
239
251
|
};
|
|
240
252
|
/** `DevtoolsOptions` with every default applied. */
|
|
241
253
|
export type ResolvedDevtoolsOptions = Required<Pick<DevtoolsOptions, "path" | "maxRequests" | "nPlusOneThreshold">> & Pick<DevtoolsOptions, "allowedHosts" | "allowProxied" | "panels" | "production">;
|
|
@@ -249,6 +261,13 @@ export type DevtoolsPanelRequest = {
|
|
|
249
261
|
query: Readonly<Record<string, string | readonly string[]>>;
|
|
250
262
|
/** The parsed request body; `undefined` when there is none. */
|
|
251
263
|
body: unknown;
|
|
264
|
+
/**
|
|
265
|
+
* `true` when the request came through a read-only share link (no signed-in
|
|
266
|
+
* user). Only the routes listed in the panel's `share.routes` are reached
|
|
267
|
+
* this way; leave developer detail (file paths, code, test names) out of
|
|
268
|
+
* the answer. Absent for every other request.
|
|
269
|
+
*/
|
|
270
|
+
shared?: boolean;
|
|
252
271
|
};
|
|
253
272
|
/**
|
|
254
273
|
* One data route of a panel, served at `<path>/api/<panel id><route path>`
|
|
@@ -295,6 +314,61 @@ export type DevtoolsPanel = {
|
|
|
295
314
|
* `import "./graph.js"`. Names are plain file names (no folders).
|
|
296
315
|
*/
|
|
297
316
|
assets?: Readonly<Record<string, string | URL>>;
|
|
317
|
+
/**
|
|
318
|
+
* A folder of images the view shows, served at
|
|
319
|
+
* `<path>/panels/<id>/files/<path inside the folder>`. Only the listed
|
|
320
|
+
* extensions are served; a path that leaves the folder answers 404.
|
|
321
|
+
*/
|
|
322
|
+
files?: DevtoolsPanelFiles;
|
|
323
|
+
/**
|
|
324
|
+
* What a read-only share link of the panel opens (production monitor with
|
|
325
|
+
* `production.share.enabled`). Without it the panel cannot be shared.
|
|
326
|
+
*/
|
|
327
|
+
share?: DevtoolsPanelShare;
|
|
328
|
+
};
|
|
329
|
+
/** A panel's folder of images (`DevtoolsPanel.files`). */
|
|
330
|
+
export type DevtoolsPanelFiles = {
|
|
331
|
+
/** The folder: an absolute path or a `file:` URL. A missing folder serves nothing. */
|
|
332
|
+
dir: string | URL;
|
|
333
|
+
/**
|
|
334
|
+
* Lower-case extensions served.
|
|
335
|
+
*
|
|
336
|
+
* @default [".png", ".jpg", ".jpeg", ".webp", ".gif"]
|
|
337
|
+
*/
|
|
338
|
+
extensions?: readonly string[];
|
|
339
|
+
};
|
|
340
|
+
/** What a share link of a panel opens (`DevtoolsPanel.share`). */
|
|
341
|
+
export type DevtoolsPanelShare = {
|
|
342
|
+
/**
|
|
343
|
+
* The view module of the shared page: a browser ES module whose default
|
|
344
|
+
* export renders like `view`, called with `context.shared === true`.
|
|
345
|
+
*/
|
|
346
|
+
view: string | URL;
|
|
347
|
+
/**
|
|
348
|
+
* Paths of the panel's GET routes the shared page may call, as written in
|
|
349
|
+
* `routes` (`"/product"`, `"/product/features/:feature"`). Every other
|
|
350
|
+
* route answers 404 through a share link.
|
|
351
|
+
*/
|
|
352
|
+
routes: readonly string[];
|
|
353
|
+
/** Served names from `assets` the shared page may load. @default [] */
|
|
354
|
+
assets?: readonly string[];
|
|
355
|
+
/** Whether the shared page may load images from `files`. @default false */
|
|
356
|
+
files?: boolean;
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* One error group as a panel sees it: counts only, no message or stack
|
|
360
|
+
* (`DevtoolsPanelFactoryContext.errors`).
|
|
361
|
+
*/
|
|
362
|
+
export type DevtoolsPanelErrorSummary = {
|
|
363
|
+
/** The route pattern the error happened on (`/products/:id`), or `null` outside a request. */
|
|
364
|
+
route: string | null;
|
|
365
|
+
status: number | null;
|
|
366
|
+
/** The error class name when known (`TypeError`). */
|
|
367
|
+
name: string | null;
|
|
368
|
+
source: "request" | "log";
|
|
369
|
+
count: number;
|
|
370
|
+
firstSeen: number;
|
|
371
|
+
lastSeen: number;
|
|
298
372
|
};
|
|
299
373
|
/** One `panels` entry: a module specifier, a ready panel, or `[specifier, options]` to pass options to the module's factory. */
|
|
300
374
|
export type DevtoolsPanelEntry = string | DevtoolsPanel | readonly [specifier: string, options: Readonly<Record<string, unknown>>];
|
|
@@ -307,6 +381,11 @@ export type DevtoolsPanelFactoryContext = {
|
|
|
307
381
|
* or run anything costly per request. Absent means `development`.
|
|
308
382
|
*/
|
|
309
383
|
mode?: DevtoolsMode;
|
|
384
|
+
/**
|
|
385
|
+
* The captured error groups of the last hour (every instance in
|
|
386
|
+
* production), counts only. Absent when the monitor captures no errors.
|
|
387
|
+
*/
|
|
388
|
+
errors?: () => Promise<readonly DevtoolsPanelErrorSummary[]>;
|
|
310
389
|
};
|
|
311
390
|
/** One panel or several. */
|
|
312
391
|
export type DevtoolsPanels = DevtoolsPanel | readonly DevtoolsPanel[];
|
|
@@ -534,5 +613,5 @@ export type DevtoolsCollector = {
|
|
|
534
613
|
clear(): void;
|
|
535
614
|
};
|
|
536
615
|
//#endregion
|
|
537
|
-
export type { DEVTOOLS_BUILT_IN_PANELS, DEVTOOLS_FAILURE_AUDIT_TYPES, DEVTOOLS_LATENCY_BUCKETS_MS, DevtoolsAccountView, DevtoolsApiErrorBody, DevtoolsAuditEntry, DevtoolsAuditType, DevtoolsAuthStepResult, DevtoolsBuiltInPanelId, DevtoolsCaptureCounters, DevtoolsCreatedInvite, DevtoolsErrorCode, DevtoolsErrorGroup, DevtoolsErrorsView, DevtoolsExplainResult, DevtoolsHealthReport, DevtoolsHealthView, DevtoolsHistogram, DevtoolsInstanceInfo, DevtoolsInstanceReport, DevtoolsInstancesView, DevtoolsInviteView, DevtoolsJobsReport, DevtoolsJobsView, DevtoolsLogRow, DevtoolsLoginInput, DevtoolsLogsView, DevtoolsMode, DevtoolsPanelInfo, DevtoolsPasswordSource, DevtoolsQueryShapeRow, DevtoolsQueryShapeStats, DevtoolsQueryStatsView, DevtoolsRecoveryCodes, DevtoolsReportLogEntry, DevtoolsResourcePoint, DevtoolsResourceSnapshot, DevtoolsResourcesView, DevtoolsRole, DevtoolsRoutePhaseStats, DevtoolsRouteStats, DevtoolsRouteStatsRow, DevtoolsRouteStatsView, DevtoolsSampleDetail, DevtoolsSampleQuery, DevtoolsSampleSummary, DevtoolsScheduleInfo, DevtoolsSessionInfo, DevtoolsSessionStage, DevtoolsSessionView, DevtoolsTotpEnrolment, DevtoolsUserListView };
|
|
616
|
+
export type { DEVTOOLS_BUILT_IN_PANELS, DEVTOOLS_FAILURE_AUDIT_TYPES, DEVTOOLS_LATENCY_BUCKETS_MS, DEVTOOLS_SHARE_LABEL_MAX, DevtoolsAccountView, DevtoolsApiErrorBody, DevtoolsAuditEntry, DevtoolsAuditType, DevtoolsAuthStepResult, DevtoolsBuiltInPanelId, DevtoolsCaptureCounters, DevtoolsCreatedInvite, DevtoolsCreatedShare, DevtoolsErrorCode, DevtoolsErrorGroup, DevtoolsErrorsView, DevtoolsExplainResult, DevtoolsHealthReport, DevtoolsHealthView, DevtoolsHistogram, DevtoolsInstanceInfo, DevtoolsInstanceReport, DevtoolsInstancesView, DevtoolsInviteView, DevtoolsJobsReport, DevtoolsJobsView, DevtoolsLogRow, DevtoolsLoginInput, DevtoolsLogsView, DevtoolsMode, DevtoolsPanelInfo, DevtoolsPasswordSource, DevtoolsQueryShapeRow, DevtoolsQueryShapeStats, DevtoolsQueryStatsView, DevtoolsRecoveryCodes, DevtoolsReportLogEntry, DevtoolsResourcePoint, DevtoolsResourceSnapshot, DevtoolsResourcesView, DevtoolsRole, DevtoolsRoutePhaseStats, DevtoolsRouteStats, DevtoolsRouteStatsRow, DevtoolsRouteStatsView, DevtoolsSampleDetail, DevtoolsSampleQuery, DevtoolsSampleSummary, DevtoolsScheduleInfo, DevtoolsSessionInfo, DevtoolsSessionStage, DevtoolsSessionView, DevtoolsShareCreateInput, DevtoolsShareList, DevtoolsShareOpenAnswer, DevtoolsShareStatus, DevtoolsShareView, DevtoolsTotpEnrolment, DevtoolsUserListView };
|
|
538
617
|
//# sourceMappingURL=types.d.mts.map
|
package/esm/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/devtools/src/types.ts"],"mappings":";;;;;;;;;;;;;;YAiBY;;;;;;EAMV;;;;;;EAMA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;;;;;;;;;EAYA,kBAAkB;;;;;;;;;;;EAWlB,aAAa;;;;;;;YAQH;;;;;;;EAOV;;;;;;;EAOA;;;;;;;EAOA;;;;;;EAMA;;;;;;;EAOA;;;;;;EAMA;;;;;;EAMA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;;;EASA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;;EAQA;;EAEA;;IAEE;;IAEA;;;;;;;EAOF;;EAEA;;IAEE;;IAEA;;IAEA;;IAEA;;IAEA;;;EAGF;;;;;;;IAOE;;;;;;;;;;EAUF,SAAS,SAAS;;;;;;EAMlB,qBAAqB;;;;;;EAMrB;;EAEA;;IAEE;;IAEA;;;;YAKQ,0BAA0B,SACpC,KAAK,kEAEL,KAAK;;YAGK;;YAGA;;EAEV,QAAQ,SAAS;;EAEjB,OAAO,SAAS;;EAEhB;;;;;;;;YASU;;EAEV,SAAS;;EAET;EACA,UAAU,SAAS;;;;;;;;;YAUT;;EAEV;;EAEA;;EAEA,eAAe;;EAEf,kBAAkB;;;;;;;;;;EAUlB;;;;;;EAMA,SAAS,SAAS,wBAAwB;;;
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/devtools/src/types.ts"],"mappings":";;;;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