@vite-hub/comments 0.5.0 → 0.5.1
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/README.md +4 -0
- package/dist/anchor.d.ts +3 -5
- package/dist/anchor.js +1 -2
- package/dist/{client-diagnostics-Bubm7Shd.js → client-diagnostics-CvfTW5d4.js} +1 -2
- package/dist/{client-files-CJZl5Kc4.js → client-files-lC6X7XyS.js} +1 -2
- package/dist/client.d.ts +15 -22
- package/dist/client.js +14 -21
- package/dist/{console-D1lwNMZn.d.ts → console-CK2F53QP.d.ts} +0 -4
- package/dist/{context-BqIsmYP1.js → context-DbkBjITZ.js} +1 -2
- package/dist/database/postgres.d.ts +1 -3
- package/dist/database/postgres.js +1 -2
- package/dist/{database-6hXRnqDE.js → database-BkPoOdZr.js} +73 -61
- package/dist/{database-CTo7mx6t.d.ts → database-CPua6Q6_.d.ts} +0 -2
- package/dist/{database-CA1aHKN7.d.ts → database-DUs3c2al.d.ts} +625 -73
- package/dist/database.d.ts +4 -6
- package/dist/database.js +1 -2
- package/dist/{define-BMBSVbD9.js → define-9uMM3Ewc.js} +2 -3
- package/dist/{define-CmIFU96x.d.ts → define-B1jLSPe9.d.ts} +1 -3
- package/dist/{errors-BJTZ9iyv.js → errors-C0VwRHiy.js} +1 -2
- package/dist/{errors-Dq4AHjza.js → errors-DFNiJg67.js} +10 -3
- package/dist/{fold-name-B7Zb3-MF.js → fold-name-g-xg0mQk.js} +1 -2
- package/dist/hosted/hosted-comments/client-B3dlmmQd.js +4 -0
- package/dist/{overlay/dist-BoHMOFax.js → hosted/hosted-comments/dist-DyVmH21U.js} +1 -1
- package/dist/hosted/hosted-comments/frame.js +1 -0
- package/dist/hosted/hosted-comments/overlay-4-mWX4Uz.js +170 -0
- package/dist/hosted/hosted-comments/protocol-BHvtQKte.js +1 -0
- package/dist/hosted/hosted-comments/rest-transport-D-9_pNqZ.js +1 -0
- package/dist/hosted/hosted-comments/tools-CdwnUCOr.js +126 -0
- package/dist/hosted/hosted-comments.js +9 -0
- package/dist/{identity-CBOzgxSf.js → identity-CT7-UGmS.js} +1 -2
- package/dist/{index-RiHzmV16.d.ts → index-BEnHTj2Z.d.ts} +5 -13
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -9
- package/dist/{install-BGGQKbQ4.d.ts → install-B-FQpi47.d.ts} +19 -8
- package/dist/{install-DrAse1Fa.js → install-BUXxryut.js} +119 -30
- package/dist/{installed-C3EoqJEY.js → installed-C9SkldMi.js} +2 -3
- package/dist/{invariant-D8_xBqmZ.js → invariant-CmdvZ3vp.js} +1 -2
- package/dist/{migrate-B0k_0swk.d.ts → migrate-XjFeQppf.d.ts} +2 -2
- package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
- package/dist/{operations-VyyNZusz.d.ts → operations-8hqTi0DH.d.ts} +0 -2
- package/dist/{operations-lsVKE0GH.js → operations-CKC_lMG_.js} +18 -20
- package/dist/{operations-BKhUWYkb.d.ts → operations-Cic9A9e_.d.ts} +4 -6
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +2 -2
- package/dist/overlay/{client-DBmJ4C1M.js → client-CerbVjTz.js} +3 -3
- package/dist/overlay/dist-DyVmH21U.js +14 -0
- package/dist/overlay/overlay.js +15 -15
- package/dist/page/loader.js +22 -21
- package/dist/{page-Bzj0CszG.d.ts → page-DE71P_gQ.d.ts} +0 -2
- package/dist/{page-tools-shared-BNnuPK93.js → page-tools-shared-fvmJQCrP.js} +2 -2
- package/dist/{page-DRz_sDY4.js → page-xzgZ6DGm.js} +2 -3
- package/dist/{path--zk6PEMz.js → path-8yqMd8zR.js} +0 -1
- package/dist/{plugin-DRsNaJaK.js → plugin-B2hETRii.js} +9 -11
- package/dist/realtime.d.ts +3 -5
- package/dist/realtime.js +4 -5
- package/dist/{reply-id-P_bSuEng.js → reply-id-Cm9FGOBs.js} +1 -2
- package/dist/{request-log-Dj9Vw7qG.js → request-log-DllKQXj7.js} +1 -2
- package/dist/{request-origin-CFU0TQ7E.js → request-origin-YPzfE2eh.js} +1 -2
- package/dist/{rpc-BQqYx8kb.js → rpc-BKY7XRlR.js} +5 -7
- package/dist/{rpc-CuJ5GLIz.d.ts → rpc-D-eqtyfh.d.ts} +1 -3
- package/dist/rpc.d.ts +1 -1
- package/dist/rpc.js +1 -2
- package/dist/runtime/auth.d.ts +3 -5
- package/dist/runtime/auth.js +2 -3
- package/dist/runtime/console.d.ts +2 -4
- package/dist/runtime/console.js +4 -5
- package/dist/runtime/index.d.ts +8 -25
- package/dist/runtime/index.js +21 -26
- package/dist/{server-Yk610niJ.js → server-BGbD7H5s.js} +2 -3
- package/dist/server.d.ts +6 -8
- package/dist/server.js +6 -6
- package/dist/{service-Bj-Mg63c.d.ts → service-CPiWPoiY.d.ts} +3 -7
- package/dist/{service-DA5BwfPQ.js → service-DDD4Ubxd.js} +9 -11
- package/dist/{session-X_g9dnU5.js → session-BGN6Vlm6.js} +7 -10
- package/dist/{session-DUcEor2W.d.ts → session-CTh9nisq.d.ts} +3 -5
- package/dist/{store-CsUNfC1w.d.ts → store-DvNTDNgn.d.ts} +2 -4
- package/dist/{table-names-B9LlRC0B.js → table-names-BIHjuEFK.js} +1 -2
- package/dist/testing.d.ts +2 -4
- package/dist/testing.js +3 -4
- package/dist/{tokens-DSbwkVSy.js → tokens-Bx4lZ0yt.js} +3 -6
- package/dist/{types-BLaYh0_f.d.ts → types-BX3vH18p.d.ts} +0 -2
- package/dist/{types-C35INXIs.d.ts → types-l6GOb_yc.d.ts} +2 -4
- package/dist/vite.d.ts +5 -21
- package/dist/vite.js +25 -43
- package/package.json +19 -19
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import { i as
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import { n as isSecureOrigin } from "./request-origin-
|
|
10
|
-
import { t as commentsErrors } from "./errors-
|
|
11
|
-
import { n as pendingKey, o as runtimes } from "./installed-
|
|
1
|
+
import { i as installCommentsRuntime } from "./server-BGbD7H5s.js";
|
|
2
|
+
import { r as guestIdPrefix } from "./identity-CT7-UGmS.js";
|
|
3
|
+
import { t as commentsErrorDiagnostics } from "./errors-DFNiJg67.js";
|
|
4
|
+
import { a as commentsSchemaGate, d as commentForge, f as commentMessages, m as commentsSchema, p as commentThreads, r as commentSendsTables, t as commentSends, u as commentCounters } from "./database-BkPoOdZr.js";
|
|
5
|
+
import { t as logFailure } from "./request-log-DllKQXj7.js";
|
|
6
|
+
import { i as getActiveCloudflareBinding, n as recentGitHubToken } from "./tokens-Bx4lZ0yt.js";
|
|
7
|
+
import { t as describeCommentContext } from "./context-DbkBjITZ.js";
|
|
8
|
+
import { t as invariant } from "./invariant-CmdvZ3vp.js";
|
|
9
|
+
import { n as isSecureOrigin } from "./request-origin-YPzfE2eh.js";
|
|
10
|
+
import { t as commentsErrors } from "./errors-C0VwRHiy.js";
|
|
11
|
+
import { n as pendingKey, o as runtimes } from "./installed-C9SkldMi.js";
|
|
12
12
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
13
13
|
import * as v from "valibot";
|
|
14
|
-
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, like, lt, lte, or, sql } from "drizzle-orm";
|
|
14
|
+
import { and, asc, desc, eq, getTableName, gt, gte, inArray, isNotNull, isNull, like, lt, lte, or, sql } from "drizzle-orm";
|
|
15
15
|
import { forgeEnv, githubAppCredentials, githubInstallationFor, githubInstallationRouting, readForgeEnv, readGitHubAppPrivateKey } from "@vite-hub/forge";
|
|
16
|
-
|
|
16
|
+
// \0rolldown/runtime.js
|
|
17
17
|
var __defProp = Object.defineProperty;
|
|
18
18
|
var __exportAll = (all, no_symbols) => {
|
|
19
19
|
let target = {};
|
|
@@ -24,8 +24,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
24
24
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
25
|
return target;
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
//#region src/operations-core/store.ts
|
|
27
|
+
// src/operations-core/store.ts
|
|
29
28
|
const chunkSize = 80;
|
|
30
29
|
const allocationAttempts = 12;
|
|
31
30
|
const candidateLimit = 200;
|
|
@@ -497,8 +496,99 @@ function createCommentsStore(database, tables = {
|
|
|
497
496
|
}
|
|
498
497
|
};
|
|
499
498
|
}
|
|
500
|
-
|
|
501
|
-
|
|
499
|
+
// src/operations-core/tenant-store.ts
|
|
500
|
+
/**
|
|
501
|
+
* A store that keeps the threads of one tenant in tables that several tenants share. It stores `scope` as the tenant
|
|
502
|
+
* and gives the threads back with the scope of Comments, so thread numbers count per tenant. Each call by id first reads
|
|
503
|
+
* the stored scope of the thread: ids are unique and a scope never changes, so a thread of another tenant is not found.
|
|
504
|
+
*/
|
|
505
|
+
function tenantCommentsStore(store, options) {
|
|
506
|
+
const { tenant } = options;
|
|
507
|
+
const tenantScope = options.scope ?? "site";
|
|
508
|
+
const owned = (thread) => thread?.scope === tenant;
|
|
509
|
+
const shown = (thread) => ({
|
|
510
|
+
...thread,
|
|
511
|
+
scope: tenantScope
|
|
512
|
+
});
|
|
513
|
+
const visible = (thread) => thread && owned(thread) ? shown(thread) : null;
|
|
514
|
+
async function own(threadId) {
|
|
515
|
+
if (!owned(await store.getById(threadId))) throw commentsErrorDiagnostics.COMMENTS_R0002({ id: threadId });
|
|
516
|
+
}
|
|
517
|
+
const canReadOwned = (canRead) => async (thread) => owned(thread) && await canRead(shown(thread));
|
|
518
|
+
return {
|
|
519
|
+
async list(query) {
|
|
520
|
+
if (query.scope !== void 0 && query.scope !== tenantScope) return [];
|
|
521
|
+
return (await store.list({
|
|
522
|
+
...query,
|
|
523
|
+
scope: tenant
|
|
524
|
+
})).map(shown);
|
|
525
|
+
},
|
|
526
|
+
async getById(id) {
|
|
527
|
+
return visible(await store.getById(id));
|
|
528
|
+
},
|
|
529
|
+
async getByNumber(scope, n) {
|
|
530
|
+
return scope === tenantScope ? visible(await store.getByNumber(tenant, n)) : null;
|
|
531
|
+
},
|
|
532
|
+
async getByRequestId(scope, requestId) {
|
|
533
|
+
return scope === tenantScope ? visible(await store.getByRequestId(tenant, requestId)) : null;
|
|
534
|
+
},
|
|
535
|
+
async getByMessage(messageId) {
|
|
536
|
+
return visible(await store.getByMessage(messageId));
|
|
537
|
+
},
|
|
538
|
+
async getByAttachment(key, cursor) {
|
|
539
|
+
const found = await store.getByAttachment(key, cursor);
|
|
540
|
+
return {
|
|
541
|
+
...found,
|
|
542
|
+
threads: found.threads.filter(owned).map(shown)
|
|
543
|
+
};
|
|
544
|
+
},
|
|
545
|
+
async createThread(input) {
|
|
546
|
+
if (input.scope !== tenantScope) throw commentsErrorDiagnostics.COMMENTS_TENANT_SCOPE_INVALID({
|
|
547
|
+
scope: input.scope,
|
|
548
|
+
tenantScope
|
|
549
|
+
});
|
|
550
|
+
return shown(await store.createThread({
|
|
551
|
+
...input,
|
|
552
|
+
scope: tenant
|
|
553
|
+
}));
|
|
554
|
+
},
|
|
555
|
+
async addMessage(threadId, input, addOptions) {
|
|
556
|
+
await own(threadId);
|
|
557
|
+
return shown(await store.addMessage(threadId, input, addOptions));
|
|
558
|
+
},
|
|
559
|
+
async editMessage(threadId, messageId, input) {
|
|
560
|
+
await own(threadId);
|
|
561
|
+
return shown(await store.editMessage(threadId, messageId, input));
|
|
562
|
+
},
|
|
563
|
+
async deleteMessage(threadId, messageId, now) {
|
|
564
|
+
await own(threadId);
|
|
565
|
+
return shown(await store.deleteMessage(threadId, messageId, now));
|
|
566
|
+
},
|
|
567
|
+
async deleteThread(threadId, ownerId) {
|
|
568
|
+
const thread = await store.getById(threadId);
|
|
569
|
+
if (!thread) return true;
|
|
570
|
+
if (!owned(thread)) return false;
|
|
571
|
+
return store.deleteThread(threadId, ownerId);
|
|
572
|
+
},
|
|
573
|
+
async setStatus(threadId, status, by, now, actor) {
|
|
574
|
+
await own(threadId);
|
|
575
|
+
return shown(await store.setStatus(threadId, status, by, now, actor));
|
|
576
|
+
},
|
|
577
|
+
async deleteScope(scope) {
|
|
578
|
+
return scope === tenantScope ? store.deleteScope(tenant) : [];
|
|
579
|
+
},
|
|
580
|
+
async deleteUser() {
|
|
581
|
+
throw commentsErrorDiagnostics.COMMENTS_TENANT_DELETE_USER();
|
|
582
|
+
},
|
|
583
|
+
async knownUsers(query, limit, canRead) {
|
|
584
|
+
return store.knownUsers(query, limit, canReadOwned(canRead));
|
|
585
|
+
},
|
|
586
|
+
async knownUsersByIds(ids, canRead) {
|
|
587
|
+
return store.knownUsersByIds(ids, canReadOwned(canRead));
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
// src/forge/github.ts
|
|
502
592
|
/** The HTTP status of a GitHub failure of the pull request sync, or `undefined` for another error. */
|
|
503
593
|
function gitHubFailureStatus(error) {
|
|
504
594
|
if (!(error instanceof Error)) return void 0;
|
|
@@ -646,8 +736,7 @@ function createGitHubClient(options = {}) {
|
|
|
646
736
|
}
|
|
647
737
|
};
|
|
648
738
|
}
|
|
649
|
-
|
|
650
|
-
//#region src/forge/render.ts
|
|
739
|
+
// src/forge/render.ts
|
|
651
740
|
/** The `<!-- -->` marker that ends every comment the sync posts, so people and tools can tell them apart. */
|
|
652
741
|
const forgeMarker = "vitehub-comments";
|
|
653
742
|
const summaryMarker = `<!-- ${forgeMarker} summary -->`;
|
|
@@ -780,8 +869,7 @@ function renderSummary(input) {
|
|
|
780
869
|
summaryMarker
|
|
781
870
|
].join("\n");
|
|
782
871
|
}
|
|
783
|
-
|
|
784
|
-
//#region src/forge/sync.ts
|
|
872
|
+
// src/forge/sync.ts
|
|
785
873
|
/** How long a row that is being posted stays claimed, so a sync that died does not block the comment for good. */
|
|
786
874
|
const claimTimeout = 6e4;
|
|
787
875
|
/** Change detection only: two FNV-1a passes, as `commentRoom()` hashes pages. */
|
|
@@ -1188,8 +1276,7 @@ function createForgeSync(options, input) {
|
|
|
1188
1276
|
}
|
|
1189
1277
|
};
|
|
1190
1278
|
}
|
|
1191
|
-
|
|
1192
|
-
//#region src/send/store.ts
|
|
1279
|
+
// src/send/store.ts
|
|
1193
1280
|
const tableNames = ["vitehub_comment_sends"];
|
|
1194
1281
|
function names(rows) {
|
|
1195
1282
|
return (Array.isArray(rows) ? rows : []).map((row) => String(Array.isArray(row) ? row[0] : Object.values(Object(row))[0]));
|
|
@@ -1255,8 +1342,7 @@ function createCommentSendStore(db, options = {}) {
|
|
|
1255
1342
|
})
|
|
1256
1343
|
};
|
|
1257
1344
|
}
|
|
1258
|
-
|
|
1259
|
-
//#region src/send/service.ts
|
|
1345
|
+
// src/send/service.ts
|
|
1260
1346
|
const grantLifetime = 864e5;
|
|
1261
1347
|
const window = 36e5;
|
|
1262
1348
|
const defaultHosts = ["relay.t3.codes"];
|
|
@@ -1919,8 +2005,7 @@ function createCommentSendService(options) {
|
|
|
1919
2005
|
}
|
|
1920
2006
|
};
|
|
1921
2007
|
}
|
|
1922
|
-
|
|
1923
|
-
//#region src/install.ts
|
|
2008
|
+
// src/install.ts
|
|
1924
2009
|
var install_exports = /* @__PURE__ */ __exportAll({ installComments: () => installComments });
|
|
1925
2010
|
/** The store, after the tables are ready: each method waits for `ready` first. */
|
|
1926
2011
|
function gated(store, ready) {
|
|
@@ -1944,7 +2029,12 @@ function installComments(comments, install) {
|
|
|
1944
2029
|
commentMessages: commentsSchema.vitehubCommentMessages,
|
|
1945
2030
|
commentThreads: commentsSchema.vitehubCommentThreads
|
|
1946
2031
|
};
|
|
1947
|
-
const
|
|
2032
|
+
const owner = install.tenant ? "app" : install.schema ?? "app";
|
|
2033
|
+
const shared = createCommentsStore(install.database, tables);
|
|
2034
|
+
const store = gated(install.tenant ? tenantCommentsStore(shared, install.tenant) : shared, commentsSchemaGate(install.database, owner, {
|
|
2035
|
+
dialect: install.dialect ?? "sqlite",
|
|
2036
|
+
...owner === "app" ? { table: getTableName(tables.commentThreads) } : {}
|
|
2037
|
+
}));
|
|
1948
2038
|
const pending = Reflect.get(comments, pendingKey);
|
|
1949
2039
|
const track = (task) => {
|
|
1950
2040
|
if (!pending) return;
|
|
@@ -1999,8 +2089,7 @@ function installComments(comments, install) {
|
|
|
1999
2089
|
...sync ? { sync } : {},
|
|
2000
2090
|
...send ? { send } : {}
|
|
2001
2091
|
});
|
|
2002
|
-
installCommentsRuntime(runtime);
|
|
2092
|
+
if (!install.tenant) installCommentsRuntime(runtime);
|
|
2003
2093
|
return runtime;
|
|
2004
2094
|
}
|
|
2005
|
-
//#endregion
|
|
2006
2095
|
export { install_exports as n, createCommentsStore as r, installComments as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-
|
|
2
|
-
|
|
1
|
+
import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-BGbD7H5s.js";
|
|
2
|
+
// src/installed.ts
|
|
3
3
|
/** The runtime that `installComments()` connected to each definition. */
|
|
4
4
|
const runtimes = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
/** The runtime that the generated Nitro plugin builds on the first call, per definition. */
|
|
@@ -27,5 +27,4 @@ async function commentSendOf(comments) {
|
|
|
27
27
|
await runtimeOf(comments);
|
|
28
28
|
return runtimes.get(comments)?.send;
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
export { runtimeOf as a, runtimeBuilds as i, pendingKey as n, runtimes as o, resolveCommentsRuntime as r, commentSendOf as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/invariant.ts
|
|
3
3
|
const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
4
4
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
5
5
|
codes: { INTERNAL_INVARIANT_FAILED: {
|
|
@@ -18,5 +18,4 @@ function invariantError(what) {
|
|
|
18
18
|
function invariant(condition, what) {
|
|
19
19
|
if (!condition) throw invariantError(what);
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { invariant as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/migrate.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* - `empty`: no `vitehub_comment_threads` table.
|
|
4
3
|
* - `live`: the tables of the live-site model: threads with `number`, `page`, and `created_by`, and `vitehub_comments`.
|
|
@@ -9,6 +8,8 @@ type CommentsSchemaState = "empty" | "live" | "outdated" | "current";
|
|
|
9
8
|
interface CommentsMigrationOptions {
|
|
10
9
|
/** `postgresql` for a Postgres Database. Default `sqlite`: SQLite, libSQL, and D1. */
|
|
11
10
|
dialect?: "sqlite" | "postgresql";
|
|
11
|
+
/** The SQL name of the threads table that tells the state. Default `vitehub_comment_threads`. */
|
|
12
|
+
table?: string;
|
|
12
13
|
}
|
|
13
14
|
interface CommentsMigration {
|
|
14
15
|
/** What the Database had before. */
|
|
@@ -50,5 +51,4 @@ declare function migrateComments(db: object, options?: CommentsMigrationOptions)
|
|
|
50
51
|
* the tables, and fails with `COMMENTS_R0019` until a migration brings them to this version.
|
|
51
52
|
*/
|
|
52
53
|
type CommentsSchemaOwner = "comments" | "app";
|
|
53
|
-
//#endregion
|
|
54
54
|
export { commentsMigrationSql as a, migrateComments as c, CommentsSchemaState as i, CommentsMigrationOptions as n, commentsSchemaState as o, CommentsSchemaOwner as r, liveThreadsBackup as s, CommentsMigration as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/object.ts
|
|
2
2
|
/** A non-null object that is not an array. Functions do not pass. */
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -7,5 +7,4 @@ function isRecord(value) {
|
|
|
7
7
|
function isRecordOrFunction(value) {
|
|
8
8
|
return Object(value) === value && !Array.isArray(value);
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { isRecordOrFunction as n, isRecord as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
-
//#region ../internal/src/operation-definition.d.ts
|
|
3
2
|
/** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
|
|
4
3
|
type OperationKind = "read" | "write" | "destructive";
|
|
5
4
|
/** The signed-in user of a call. */
|
|
@@ -167,5 +166,4 @@ interface OperationContributionEntry {
|
|
|
167
166
|
}
|
|
168
167
|
/** The contribution of a plugin: a list, or a function that returns it, for a plugin that reads the project first. */
|
|
169
168
|
type OperationContributions = readonly OperationContributionEntry[] | (() => readonly OperationContributionEntry[] | Promise<readonly OperationContributionEntry[]>);
|
|
170
|
-
//#endregion
|
|
171
169
|
export { OperationContributions as n, AnyOperation as t };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { n as outboxAccountHeader } from "./client-files-
|
|
2
|
-
import { t as commentsErrorDiagnostics } from "./errors-
|
|
3
|
-
import { n as pagePathOf, t as isPagePath } from "./path
|
|
4
|
-
import { n as isRecordOrFunction } from "./object-
|
|
5
|
-
import { C as clientAddressKey, S as suggest, T as createClientRateLimit, _ as requestIdSchema, a as createThread, c as earlierThread, d as maximumAttachmentBytes, f as maximumCommentBodyLength, g as replyToThread, h as readAttachment, l as editMessage, m as personOf, n as base64, o as deniedError, r as can, s as earlierReply, t as attachmentThread, u as fail, v as retried, x as storeAttachment, y as retriedReply } from "./service-
|
|
6
|
-
import { n as guestFromHeaders, t as authorOf } from "./identity-
|
|
7
|
-
import { t as describeCommentContext } from "./context-
|
|
8
|
-
import { t as commentsRuntime } from "./server-
|
|
1
|
+
import { n as outboxAccountHeader } from "./client-files-lC6X7XyS.js";
|
|
2
|
+
import { t as commentsErrorDiagnostics } from "./errors-DFNiJg67.js";
|
|
3
|
+
import { n as pagePathOf, t as isPagePath } from "./path-8yqMd8zR.js";
|
|
4
|
+
import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
|
|
5
|
+
import { C as clientAddressKey, S as suggest, T as createClientRateLimit, _ as requestIdSchema, a as createThread, c as earlierThread, d as maximumAttachmentBytes, f as maximumCommentBodyLength, g as replyToThread, h as readAttachment, l as editMessage, m as personOf, n as base64, o as deniedError, r as can, s as earlierReply, t as attachmentThread, u as fail, v as retried, x as storeAttachment, y as retriedReply } from "./service-DDD4Ubxd.js";
|
|
6
|
+
import { n as guestFromHeaders, t as authorOf } from "./identity-CT7-UGmS.js";
|
|
7
|
+
import { t as describeCommentContext } from "./context-DbkBjITZ.js";
|
|
8
|
+
import { t as commentsRuntime } from "./server-BGbD7H5s.js";
|
|
9
9
|
import { defineDiagnostics } from "nostics";
|
|
10
10
|
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
11
11
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
12
12
|
import * as v from "valibot";
|
|
13
|
-
|
|
13
|
+
// ../internal/src/error-diagnostics.ts
|
|
14
14
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
15
15
|
const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
16
16
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
@@ -267,6 +267,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
267
267
|
why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
|
|
268
268
|
fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
|
|
269
269
|
},
|
|
270
|
+
INTERNAL_SITE_TOKEN_TOO_LONG: {
|
|
271
|
+
why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
|
|
272
|
+
fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
|
|
273
|
+
},
|
|
270
274
|
INTERNAL_SQLITE_ARGUMENT_INVALID: {
|
|
271
275
|
why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
|
|
272
276
|
fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
|
|
@@ -281,8 +285,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
281
285
|
}
|
|
282
286
|
}
|
|
283
287
|
});
|
|
284
|
-
|
|
285
|
-
//#region ../internal/src/standard-schema.ts
|
|
288
|
+
// ../internal/src/standard-schema.ts
|
|
286
289
|
function readOwn(value, key) {
|
|
287
290
|
if (value === null || Object(value) !== value) return;
|
|
288
291
|
try {
|
|
@@ -311,8 +314,7 @@ function standardJsonSchema(schema, direction, target = "draft-2020-12", library
|
|
|
311
314
|
return;
|
|
312
315
|
}
|
|
313
316
|
}
|
|
314
|
-
|
|
315
|
-
//#region ../internal/src/valibot.ts
|
|
317
|
+
// ../internal/src/valibot.ts
|
|
316
318
|
const valibotTargets = /* @__PURE__ */ new Set([
|
|
317
319
|
"draft-07",
|
|
318
320
|
"draft-2020-12",
|
|
@@ -353,8 +355,7 @@ function withValibotJsonSchema(schema, options = {}) {
|
|
|
353
355
|
}
|
|
354
356
|
};
|
|
355
357
|
}
|
|
356
|
-
|
|
357
|
-
//#region ../internal/src/operation-definition.ts
|
|
358
|
+
// ../internal/src/operation-definition.ts
|
|
358
359
|
const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
|
|
359
360
|
const kinds = /* @__PURE__ */ new Set([
|
|
360
361
|
"read",
|
|
@@ -433,8 +434,7 @@ function operationAccessAllows(access, section, call) {
|
|
|
433
434
|
if (!grants.some((grant) => sections.includes(`${grant}:read`))) return false;
|
|
434
435
|
return call === void 0 || call.kind === "read" || call.readOnly === true;
|
|
435
436
|
}
|
|
436
|
-
|
|
437
|
-
//#region src/thread-text.ts
|
|
437
|
+
// src/thread-text.ts
|
|
438
438
|
function commentPersonName(person) {
|
|
439
439
|
return `${person.name ?? person.id}${person.guest ? " (guest)" : ""}`;
|
|
440
440
|
}
|
|
@@ -522,8 +522,7 @@ function commentThreadsText(threads, status, note) {
|
|
|
522
522
|
if (!threads.length) return note ? `No ${status} threads that this caller may read. ${note}` : `No ${status} threads.`;
|
|
523
523
|
return [...threads.map(commentThreadLine), ...note ? ["", note] : []].join("\n");
|
|
524
524
|
}
|
|
525
|
-
|
|
526
|
-
//#region src/operations-core/operations.ts
|
|
525
|
+
// src/operations-core/operations.ts
|
|
527
526
|
const defaultLimit = 200;
|
|
528
527
|
const maximumLimit = 500;
|
|
529
528
|
const maximumSuggestions = 10;
|
|
@@ -1248,5 +1247,4 @@ const commentsOperations = [
|
|
|
1248
1247
|
section: "comments"
|
|
1249
1248
|
})
|
|
1250
1249
|
];
|
|
1251
|
-
//#endregion
|
|
1252
1250
|
export { commentThreadSummary as a, hiddenThreadsNote as c, commentsOperations as i, commentAnchorSchema as n, commentThreadsText as o, commentInputSchemas as r, describeCommentThread as s, commentActions as t };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { i as CommentsRuntime, t as CommentsAttachmentBody } from "./service-CPiWPoiY.js";
|
|
2
|
+
import { t as AnyOperation } from "./operations-8hqTi0DH.js";
|
|
3
|
+
import { f as CommentsPolicyGate, g as CommentsUser } from "./define-B1jLSPe9.js";
|
|
4
|
+
import { C as CommentStatusInput, D as CommentUser, E as CommentUploadInput, O as CommentUsersInput, T as CommentThread, c as CommentCreateInput, f as CommentEditInput, g as CommentGetInput, i as CommentAttachment, l as CommentDeleteInput, n as CommentActor, s as CommentContext, v as CommentListQuery, x as CommentReplyInput, y as CommentMessage } from "./types-BX3vH18p.js";
|
|
5
5
|
import * as v from "valibot";
|
|
6
|
-
//#region src/operations-core/operations.d.ts
|
|
7
6
|
declare const anchor: v.UnionSchema<[v.StrictObjectSchema<{
|
|
8
7
|
readonly kind: v.LiteralSchema<"page", undefined>;
|
|
9
8
|
}, undefined>, v.StrictObjectSchema<{
|
|
@@ -258,5 +257,4 @@ declare const commentActions: {
|
|
|
258
257
|
};
|
|
259
258
|
/** The comment operations. The Console, the CLI, MCP, and the comments client call them. */
|
|
260
259
|
declare const commentsOperations: readonly AnyOperation[];
|
|
261
|
-
//#endregion
|
|
262
260
|
export { commentsOperations as a, commentInputSchemas as i, commentActions as n, commentAnchorSchema as r, CommentsCaller as t };
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as maximumCommentBodyLength } from "./service-
|
|
2
|
-
import { a as commentsOperations, i as commentInputSchemas, n as commentActions, r as commentAnchorSchema, t as CommentsCaller } from "./operations-
|
|
1
|
+
import { a as maximumCommentBodyLength } from "./service-CPiWPoiY.js";
|
|
2
|
+
import { a as commentsOperations, i as commentInputSchemas, n as commentActions, r as commentAnchorSchema, t as CommentsCaller } from "./operations-Cic9A9e_.js";
|
|
3
3
|
export { CommentsCaller, commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, maximumCommentBodyLength };
|
package/dist/operations.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-
|
|
2
|
-
import { f as maximumCommentBodyLength } from "./service-
|
|
1
|
+
import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-CKC_lMG_.js";
|
|
2
|
+
import { f as maximumCommentBodyLength } from "./service-DDD4Ubxd.js";
|
|
3
3
|
export { commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, maximumCommentBodyLength };
|