@vite-hub/comments 0.0.0 → 0.1.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/LICENSE +201 -0
- package/README.md +243 -0
- package/dist/anchor.d.ts +40 -0
- package/dist/anchor.js +128 -0
- package/dist/client.d.ts +101 -0
- package/dist/client.js +553 -0
- package/dist/console-BIz9t2cO.d.ts +243 -0
- package/dist/database/postgres.d.ts +1011 -0
- package/dist/database/postgres.js +60 -0
- package/dist/database-BSnVrwHn.js +60 -0
- package/dist/database-C-ktS9Do.js +95 -0
- package/dist/database-Cb2xjC1V.d.ts +1096 -0
- package/dist/database.d.ts +104 -0
- package/dist/database.js +3 -0
- package/dist/define-BzW2Ychn.d.ts +46 -0
- package/dist/define-Cbhl6QVJ.js +32 -0
- package/dist/errors-BAQYcy3_.d.ts +89 -0
- package/dist/errors-DeD6wTCl.js +77 -0
- package/dist/h3-v1-request-DDGXJ9E7.js +166 -0
- package/dist/identity-3qtVC4rF.js +34 -0
- package/dist/index-DklG2Etf.d.ts +111 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +5 -0
- package/dist/operations-0B0QTVWX.d.ts +138 -0
- package/dist/operations-NZG5dB8y.js +732 -0
- package/dist/operations.d.ts +7 -0
- package/dist/operations.js +2 -0
- package/dist/overlay/overlay.js +195 -0
- package/dist/page/loader.js +22 -0
- package/dist/page-BtXADR6d.d.ts +21 -0
- package/dist/page-BuroSMXO.js +38 -0
- package/dist/page-tools-shared-D-amu6sx.js +53 -0
- package/dist/plugin-QElKQYkA.js +725 -0
- package/dist/realtime.d.ts +18 -0
- package/dist/realtime.js +48 -0
- package/dist/request-DVc3M_AG.js +14 -0
- package/dist/rpc.d.ts +29 -0
- package/dist/rpc.js +75 -0
- package/dist/runtime/auth.d.ts +6 -0
- package/dist/runtime/auth.js +15 -0
- package/dist/runtime/connect/node.d.ts +1 -0
- package/dist/runtime/connect/node.js +2 -0
- package/dist/runtime/connect.d.ts +1 -0
- package/dist/runtime/connect.js +2 -0
- package/dist/runtime/console.d.ts +5 -0
- package/dist/runtime/console.js +59 -0
- package/dist/runtime/index.d.ts +222 -0
- package/dist/runtime/index.js +665 -0
- package/dist/server-BomGg3Gb.js +63 -0
- package/dist/server.d.ts +94 -0
- package/dist/server.js +326 -0
- package/dist/src-CRTwnaEG.js +1362 -0
- package/dist/testing.d.ts +30 -0
- package/dist/testing.js +175 -0
- package/dist/types-Cj8K7Vx7.d.ts +176 -0
- package/dist/types-Un2dcJWD.d.ts +288 -0
- package/dist/vite.d.ts +304 -0
- package/dist/vite.js +1921 -0
- package/package.json +156 -4
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
//#region ../internal/src/inspect.d.ts
|
|
2
|
+
interface ViteHubDefinitionField {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
/** Serializable summary of one discovered Definition. Files are relative to the project root. */
|
|
7
|
+
interface ViteHubDefinitionSummary {
|
|
8
|
+
fields: readonly ViteHubDefinitionField[];
|
|
9
|
+
file: string;
|
|
10
|
+
name: string;
|
|
11
|
+
source: string;
|
|
12
|
+
}
|
|
13
|
+
/** Lists the Definitions that one owner package discovered for the resolved Vite config. */
|
|
14
|
+
interface ViteHubDefinitionInspector {
|
|
15
|
+
/** Stable singular kind, for example `queue` or `rate-limit`. */
|
|
16
|
+
kind: string;
|
|
17
|
+
label: string;
|
|
18
|
+
list: () => Promise<readonly ViteHubDefinitionSummary[]> | readonly ViteHubDefinitionSummary[];
|
|
19
|
+
}
|
|
20
|
+
/** One generated Provider Output file or directory that an owner package can write. */
|
|
21
|
+
interface ViteHubProviderOutputEntry {
|
|
22
|
+
description: string;
|
|
23
|
+
owner: string;
|
|
24
|
+
/** Absolute path. */
|
|
25
|
+
path: string;
|
|
26
|
+
}
|
|
27
|
+
interface ViteHubInspectionContributor {
|
|
28
|
+
definitions?: readonly ViteHubDefinitionInspector[];
|
|
29
|
+
providerOutput?: readonly ViteHubProviderOutputEntry[];
|
|
30
|
+
}
|
|
31
|
+
type ViteHubInspectionContributorFactory = () => ViteHubInspectionContributor | undefined | Promise<ViteHubInspectionContributor | undefined>;
|
|
32
|
+
interface ViteHubInspectionPluginMetadata {
|
|
33
|
+
inspect?: ViteHubInspectionContributor | ViteHubInspectionContributorFactory;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region ../internal/src/console.d.ts
|
|
37
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
38
|
+
/** Lists discovered Definitions in a sidebar and shows the selected Definition's fields. */
|
|
39
|
+
interface ViteHubConsoleDefinitionCatalogView {
|
|
40
|
+
kind: "definition-catalog";
|
|
41
|
+
/** States which runtime data this catalog does not include. */
|
|
42
|
+
notice: string;
|
|
43
|
+
}
|
|
44
|
+
interface ViteHubConsoleRecordColumn {
|
|
45
|
+
/** Key in `ViteHubConsoleRecord.cells`. */
|
|
46
|
+
key: string;
|
|
47
|
+
label: string;
|
|
48
|
+
}
|
|
49
|
+
/** Shows records in a table and the selected record's fields in a detail panel. */
|
|
50
|
+
interface ViteHubConsoleRecordTableView {
|
|
51
|
+
columns: readonly ViteHubConsoleRecordColumn[];
|
|
52
|
+
kind: "record-table";
|
|
53
|
+
/** States the source and limits of the records. */
|
|
54
|
+
notice: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Lists the collections and documents of an owner runtime and edits them with owner actions: a form generated from each
|
|
58
|
+
* collection's JSON Schema, a Markdown body, save, publish, and revision history.
|
|
59
|
+
*/
|
|
60
|
+
interface ViteHubConsoleDocumentEditorView {
|
|
61
|
+
kind: "document-editor";
|
|
62
|
+
/** States where documents are stored and what the editor does not do. */
|
|
63
|
+
notice: string;
|
|
64
|
+
}
|
|
65
|
+
interface ViteHubConsoleOperationColumn {
|
|
66
|
+
/** Dot path into each item of the result, such as `author.name` or `messages.0.body`. */
|
|
67
|
+
key: string;
|
|
68
|
+
label: string;
|
|
69
|
+
/** `datetime` shows a time in milliseconds since the epoch as a date. `excerpt` cuts a long text. */
|
|
70
|
+
format?: "datetime" | "excerpt";
|
|
71
|
+
}
|
|
72
|
+
/** A chip above the list. Choosing it merges `input` into the operation input. The first chip is the default. */
|
|
73
|
+
interface ViteHubConsoleOperationFilter {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
input: Readonly<Record<string, unknown>>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Lists the items that an operation returns, called over the Console RPC with the signed-in Console user. The operation
|
|
80
|
+
* checks the access of that user for each item, so the view shows only what the user may read. `operation` must return an
|
|
81
|
+
* array of objects with an `id`. A failure of the operation, with its `fix`, shows where the list would be.
|
|
82
|
+
*/
|
|
83
|
+
interface ViteHubConsoleOperationView {
|
|
84
|
+
columns: readonly ViteHubConsoleOperationColumn[];
|
|
85
|
+
filters?: readonly ViteHubConsoleOperationFilter[];
|
|
86
|
+
kind: "operation-view";
|
|
87
|
+
/**
|
|
88
|
+
* Makes each row a link: `{path}` placeholders take values from the item and are URL-encoded, and `{path:path}` takes an
|
|
89
|
+
* app path and encodes each segment (a value that is not an app path, such as `//evil.com/x`, gives no link). Rows where
|
|
90
|
+
* `when.path` is not `when.equals` get none.
|
|
91
|
+
*/
|
|
92
|
+
link?: {
|
|
93
|
+
label?: string;
|
|
94
|
+
template: string;
|
|
95
|
+
when?: {
|
|
96
|
+
equals: string;
|
|
97
|
+
path: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
notice: string;
|
|
101
|
+
/** Operation name, such as `comments.list`. */
|
|
102
|
+
operation: string;
|
|
103
|
+
/** Fetch every page with `limit` and a `before` object whose keys read these dot paths from the last item. */
|
|
104
|
+
pagination?: {
|
|
105
|
+
limit: number;
|
|
106
|
+
cursor: Readonly<Record<string, string>>;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
interface ViteHubConsoleAuthView {
|
|
110
|
+
kind: "auth-management";
|
|
111
|
+
notice: string;
|
|
112
|
+
}
|
|
113
|
+
type ViteHubConsoleSectionView = ViteHubConsoleOperationView | ViteHubConsoleAuthView | ViteHubConsoleDefinitionCatalogView | ViteHubConsoleRecordTableView | ViteHubConsoleDocumentEditorView;
|
|
114
|
+
/**
|
|
115
|
+
* The overview of a document editor section: document counts by state, the changes that wait for a publish, recent
|
|
116
|
+
* activity, and a New button per collection. It reads the owner `overview` action.
|
|
117
|
+
*/
|
|
118
|
+
interface ViteHubConsoleDocumentDashboardView {
|
|
119
|
+
kind: "document-dashboard";
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The media library of a document editor section: folders, uploads, alt text, focal points, and crops of the Blob Store
|
|
123
|
+
* that `blob.serve` serves. The owner decides who may use it with `mediaAccess`, and finds the documents that use a file
|
|
124
|
+
* with `references`. The page needs the Blob section, so declare it with `requires: ["blob"]`.
|
|
125
|
+
*/
|
|
126
|
+
interface ViteHubConsoleMediaLibraryView {
|
|
127
|
+
kind: "media-library";
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The singletons of a document editor section, such as site settings: one row per singleton that opens it in the
|
|
131
|
+
* editor. Singletons appear here instead of among the collections, and the Console hides the page when the section has
|
|
132
|
+
* none.
|
|
133
|
+
*/
|
|
134
|
+
interface ViteHubConsoleDocumentSettingsView {
|
|
135
|
+
kind: "document-settings";
|
|
136
|
+
}
|
|
137
|
+
/** A view that the Console UI in `vite-hub` renders for a section page. */
|
|
138
|
+
type ViteHubConsoleSectionPageView = ViteHubConsoleDocumentDashboardView | ViteHubConsoleDocumentSettingsView | ViteHubConsoleMediaLibraryView;
|
|
139
|
+
/**
|
|
140
|
+
* A page of a section next to its main view, such as the Content dashboard or media library. The section sidebar lists
|
|
141
|
+
* the pages, and each page has its own URL:
|
|
142
|
+
*
|
|
143
|
+
* - `/_vitehub/<section>` serves the `index` page, or the main view when the section has none.
|
|
144
|
+
* - `/_vitehub/<section>/-/<page>` serves every other page. The `-` segment keeps page URLs apart from the main view's
|
|
145
|
+
* own segments, such as a collection name.
|
|
146
|
+
*
|
|
147
|
+
* Pages share the access of their section: `console.authorize` that allows the section allows every page of it.
|
|
148
|
+
*/
|
|
149
|
+
interface ViteHubConsoleSectionPage {
|
|
150
|
+
/** Lowercase route segment, for example `media`. */
|
|
151
|
+
id: string;
|
|
152
|
+
/** Display name, for example `Media`. */
|
|
153
|
+
label: string;
|
|
154
|
+
/** Iconify class name, for example `i-lucide-image`. */
|
|
155
|
+
icon: string;
|
|
156
|
+
view: ViteHubConsoleSectionPageView;
|
|
157
|
+
/**
|
|
158
|
+
* Serve this page at the section root. At most one page sets it, and `/_vitehub/<section>/-/<id>` then redirects to
|
|
159
|
+
* the root.
|
|
160
|
+
*/
|
|
161
|
+
index?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Sidebar heading, for example `Assets`. Pages without a group lead the sidebar, above the main view's navigation.
|
|
164
|
+
* Grouped pages follow it, in the order their group first appears.
|
|
165
|
+
*/
|
|
166
|
+
group?: string;
|
|
167
|
+
/** Section ids that the project must enable, such as `["blob"]`. The Console leaves the page out otherwise. */
|
|
168
|
+
requires?: readonly string[];
|
|
169
|
+
}
|
|
170
|
+
/** One entry of a record's activity, such as a comment in a thread. `at` is an ISO 8601 timestamp. */
|
|
171
|
+
interface ViteHubConsoleRecordActivity {
|
|
172
|
+
author: string;
|
|
173
|
+
at: string;
|
|
174
|
+
text: string;
|
|
175
|
+
}
|
|
176
|
+
/** One serializable record row. Values are display strings. Do not put credentials in records. */
|
|
177
|
+
interface ViteHubConsoleRecord {
|
|
178
|
+
cells: Readonly<Record<string, string>>;
|
|
179
|
+
fields: readonly ViteHubDefinitionField[];
|
|
180
|
+
id: string;
|
|
181
|
+
/** The Console can run this record when it represents a runnable Schedule Definition. */
|
|
182
|
+
runnable?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Where the record lives in the app, such as the page of a comment thread. `href` is an app path that starts with one
|
|
185
|
+
* `/`, or an `https:` URL. The Console opens it in a new tab.
|
|
186
|
+
*/
|
|
187
|
+
link?: {
|
|
188
|
+
href: string;
|
|
189
|
+
label: string;
|
|
190
|
+
};
|
|
191
|
+
/** Entries in time order, such as the comments of a thread. The Console shows them as a conversation. */
|
|
192
|
+
activity?: readonly ViteHubConsoleRecordActivity[];
|
|
193
|
+
}
|
|
194
|
+
/** Serializable description of a Console section. The Console UI in `vite-hub` renders the view. */
|
|
195
|
+
interface ViteHubConsoleSectionDescriptor<TView extends ViteHubConsoleSectionView = ViteHubConsoleSectionView> {
|
|
196
|
+
description: string;
|
|
197
|
+
/**
|
|
198
|
+
* Iconify class name, for example `i-lucide-inbox`. The Console draws with Lucide; `ph` also resolves. The
|
|
199
|
+
* Console build bundles the icon of every section in the `vite-hub` Console registry and fails if it cannot resolve one.
|
|
200
|
+
*/
|
|
201
|
+
icon: string;
|
|
202
|
+
/** Lowercase route segment, for example `queues`. The Console serves the section at `/_vitehub/<id>`. */
|
|
203
|
+
id: string;
|
|
204
|
+
/** Plural display name, for example `Queues`. */
|
|
205
|
+
label: string;
|
|
206
|
+
view: TView;
|
|
207
|
+
/** Pages next to the main view, in sidebar order. Only document editor sections render pages today. */
|
|
208
|
+
pages?: readonly ViteHubConsoleSectionPage[];
|
|
209
|
+
}
|
|
210
|
+
/** A named export of an owner package server module that the host imports in its generated server code. */
|
|
211
|
+
interface ViteHubConsoleServerExport {
|
|
212
|
+
/** Named export of `module`. */
|
|
213
|
+
export: string;
|
|
214
|
+
/**
|
|
215
|
+
* Owner package module specifier, for example `@vite-hub/email/runtime/console`. The host maps it to the module
|
|
216
|
+
* path that the application can import.
|
|
217
|
+
*/
|
|
218
|
+
module: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Server module export that returns records on each Console request. The export must be a
|
|
222
|
+
* {@link ViteHubConsoleRuntimeRecordReader}.
|
|
223
|
+
*/
|
|
224
|
+
interface ViteHubConsoleRuntimeReader extends ViteHubConsoleServerExport {}
|
|
225
|
+
/**
|
|
226
|
+
* A record table that also reads records at request time. The Console shows the build-time records of `read` first,
|
|
227
|
+
* then the records of the `runtime` reader. A runtime record replaces a build-time record with the same id.
|
|
228
|
+
*/
|
|
229
|
+
interface ViteHubConsoleRuntimeRecordTableSection<TOptions = void> extends ViteHubConsoleSectionDescriptor<ViteHubConsoleRecordTableView> {
|
|
230
|
+
/** Reads build-time records on the server. When omitted, the section has only runtime records. */
|
|
231
|
+
read?: (options: TOptions) => MaybePromise<readonly ViteHubConsoleRecord[]>;
|
|
232
|
+
runtime: ViteHubConsoleRuntimeReader;
|
|
233
|
+
/**
|
|
234
|
+
* Returns the absolute path of the application module that turns the section on, such as `server/comments.ts`, or
|
|
235
|
+
* `undefined` when the project has none. With it, the host shows the section only when the module exists; without
|
|
236
|
+
* it, a Vite option enables the section.
|
|
237
|
+
*/
|
|
238
|
+
entry?: (options: TOptions) => MaybePromise<string | undefined>;
|
|
239
|
+
}
|
|
240
|
+
/** A section whose list comes from an operation, called with the Console user on each visit. It has no build-time data. */
|
|
241
|
+
interface ViteHubConsoleOperationSection extends ViteHubConsoleSectionDescriptor<ViteHubConsoleOperationView> {}
|
|
242
|
+
//#endregion
|
|
243
|
+
export { ViteHubInspectionPluginMetadata as i, ViteHubConsoleRecord as n, ViteHubConsoleRuntimeRecordTableSection as r, ViteHubConsoleOperationSection as t };
|