yamlite 0.0.0-stage → 0.35.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 +21 -0
- package/README.md +746 -2
- package/dist/browser/aliases.d.mts +6 -0
- package/dist/browser/aliases.mjs +42 -0
- package/dist/browser/chokidar.d.mts +17 -0
- package/dist/browser/chokidar.mjs +64 -0
- package/dist/browser/crypto.d.mts +11 -0
- package/dist/browser/crypto.mjs +27 -0
- package/dist/browser/expose.d.mts +3 -0
- package/dist/browser/expose.mjs +80 -0
- package/dist/browser/fs.d.mts +85 -0
- package/dist/browser/fs.mjs +1 -0
- package/dist/browser/globals.d.mts +1 -0
- package/dist/browser/globals.mjs +21 -0
- package/dist/browser/os.d.mts +9 -0
- package/dist/browser/os.mjs +9 -0
- package/dist/browser/path.d.mts +28 -0
- package/dist/browser/path.mjs +15 -0
- package/dist/browser/sqlite.d.mts +48 -0
- package/dist/browser/sqlite.mjs +219 -0
- package/dist/browser/unavailable.d.mts +15 -0
- package/dist/browser/unavailable.mjs +21 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +433 -0
- package/dist/core.d.mts +527 -0
- package/dist/core.mjs +3 -0
- package/dist/fs-DZ4QHM93.mjs +251 -0
- package/dist/guide.md +171 -0
- package/dist/index-BBHZ8yok.d.mts +316 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/src-DKu7thkC.mjs +8030 -0
- package/dist/ui/assets/ErdView-Bpo3_oCp.js +8 -0
- package/dist/ui/assets/ErdView-DLioOiRN.css +1 -0
- package/dist/ui/assets/MarkdownField-CRtDmSzB.js +32 -0
- package/dist/ui/assets/PageView-6iig-DcM.js +1 -0
- package/dist/ui/assets/index-BIkG4xcY.css +2 -0
- package/dist/ui/assets/index-CqIdjmI5.js +125 -0
- package/dist/ui/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/ui/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/ui/assets/jetbrains-mono-latin-700-normal-BYuf6tUa.woff2 +0 -0
- package/dist/ui/assets/jetbrains-mono-latin-700-normal-D3wTyLJW.woff +0 -0
- package/dist/ui/assets/load-kYvvjpD1.js +2 -0
- package/dist/ui/assets/outfit-latin-400-normal-BGsTXAXT.woff2 +0 -0
- package/dist/ui/assets/outfit-latin-400-normal-DMwTpYkH.woff +0 -0
- package/dist/ui/assets/outfit-latin-500-normal-ClnHRwRh.woff +0 -0
- package/dist/ui/assets/outfit-latin-500-normal-DKnIMDSk.woff2 +0 -0
- package/dist/ui/assets/outfit-latin-600-normal-B7SfZ07L.woff2 +0 -0
- package/dist/ui/assets/outfit-latin-600-normal-BEfTtDA7.woff +0 -0
- package/dist/ui/assets/outfit-latin-700-normal-Cu9v6i1X.woff2 +0 -0
- package/dist/ui/assets/outfit-latin-700-normal-D4itBLBr.woff +0 -0
- package/dist/ui/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/ui/assets/sql-wasm-C1D_RJuy.wasm +0 -0
- package/dist/ui/assets/sql-wasm-Dnr4gnQb.js +1 -0
- package/dist/ui/assets/sql-wasm-browser-CNwHQfY0.js +2 -0
- package/dist/ui/assets/theme-CMaLONsO.js +1 -0
- package/dist/ui/favicon.svg +6 -0
- package/dist/ui/index.html +26 -0
- package/dist/ui-embed/ErdView-Dk-iexgy.js +10362 -0
- package/dist/ui-embed/HintPopover-D5P2UuTa.js +8257 -0
- package/dist/ui-embed/MarkdownField-DTAEh2oz.js +5211 -0
- package/dist/ui-embed/PageView-Cpq5JtTW.js +818 -0
- package/dist/ui-embed/activity-letLdXN4.js +190 -0
- package/dist/ui-embed/dist-CkcIwL4M.js +8142 -0
- package/dist/ui-embed/embed.js +18684 -0
- package/dist/ui-embed/favicon.svg +6 -0
- package/dist/ui-embed/page-frame.js +7 -0
- package/dist/ui-embed/pageFrame-Dm62WvvT.js +2556 -0
- package/dist/ui-embed/style.css +3 -0
- package/dist/ui-embed/tabs-CLBiDAgo.js +17095 -0
- package/dist/ui-embed/theme-BwJfOY1V.js +2951 -0
- package/dist/workspace-BHg_GGkH.mjs +896 -0
- package/package.json +171 -3
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type ColumnType = "INTEGER" | "REAL" | "TEXT" | "BOOLEAN" | "JSON";
|
|
3
|
+
type ColumnFormat = "markdown" | "date" | "datetime" | "list" | "map";
|
|
4
|
+
type AllowedValue = string | number | boolean;
|
|
5
|
+
type Bound = number | string;
|
|
6
|
+
type Mode = "files" | "list";
|
|
7
|
+
type Rec = Record<string, unknown>;
|
|
8
|
+
type DbValue = null | number | bigint | string | Uint8Array;
|
|
9
|
+
type DbRow = Record<string, DbValue>;
|
|
10
|
+
interface IndexSpec {
|
|
11
|
+
columns?: string[];
|
|
12
|
+
expr?: string;
|
|
13
|
+
unique: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface Reference {
|
|
16
|
+
column: string;
|
|
17
|
+
table: string;
|
|
18
|
+
target?: string;
|
|
19
|
+
}
|
|
20
|
+
interface ExpandSpec {
|
|
21
|
+
field: string;
|
|
22
|
+
name: string;
|
|
23
|
+
columns: Record<string, ColumnType>;
|
|
24
|
+
formats: Record<string, ColumnFormat>;
|
|
25
|
+
references: Reference[];
|
|
26
|
+
values: Record<string, AllowedValue[]>;
|
|
27
|
+
required: string[];
|
|
28
|
+
min: Record<string, Bound>;
|
|
29
|
+
max: Record<string, Bound>;
|
|
30
|
+
expand: ExpandSpec[];
|
|
31
|
+
}
|
|
32
|
+
interface ViewRecord {
|
|
33
|
+
name: string;
|
|
34
|
+
table: string;
|
|
35
|
+
parent: string;
|
|
36
|
+
columns: Record<string, ColumnType>;
|
|
37
|
+
identity: string[];
|
|
38
|
+
}
|
|
39
|
+
interface Claim {
|
|
40
|
+
owner: string;
|
|
41
|
+
path: string;
|
|
42
|
+
glob: string | null;
|
|
43
|
+
tie: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface Capture {
|
|
46
|
+
column: string;
|
|
47
|
+
segment: number;
|
|
48
|
+
}
|
|
49
|
+
interface TableSpec {
|
|
50
|
+
name: string;
|
|
51
|
+
path: string;
|
|
52
|
+
mode: Mode;
|
|
53
|
+
glob: string | null;
|
|
54
|
+
codec: "yaml" | "markdown";
|
|
55
|
+
body: string | null;
|
|
56
|
+
key: string;
|
|
57
|
+
columns: Record<string, ColumnType>;
|
|
58
|
+
formats: Record<string, ColumnFormat>;
|
|
59
|
+
indexes: IndexSpec[];
|
|
60
|
+
references: Reference[];
|
|
61
|
+
values: Record<string, AllowedValue[]>;
|
|
62
|
+
required: string[];
|
|
63
|
+
min: Record<string, Bound>;
|
|
64
|
+
max: Record<string, Bound>;
|
|
65
|
+
persisted: boolean;
|
|
66
|
+
exclude: Claim[];
|
|
67
|
+
expand: ExpandSpec[];
|
|
68
|
+
group: string | null;
|
|
69
|
+
split: string | null;
|
|
70
|
+
captures: Capture[];
|
|
71
|
+
}
|
|
72
|
+
type PageAccess = "read" | "write";
|
|
73
|
+
interface PageSpec {
|
|
74
|
+
name: string;
|
|
75
|
+
path: string;
|
|
76
|
+
title: string;
|
|
77
|
+
access: Record<string, PageAccess>;
|
|
78
|
+
sql: boolean;
|
|
79
|
+
network: string[];
|
|
80
|
+
ai: {
|
|
81
|
+
maxOutputTokens: number;
|
|
82
|
+
} | null;
|
|
83
|
+
}
|
|
84
|
+
interface SchemaChange {
|
|
85
|
+
op: "createIndex" | "dropIndex" | "alterColumn" | "dropColumn" | "createView" | "dropView";
|
|
86
|
+
name: string;
|
|
87
|
+
definition: string;
|
|
88
|
+
}
|
|
89
|
+
interface ConflictInfo {
|
|
90
|
+
table: string;
|
|
91
|
+
key: string;
|
|
92
|
+
winner: "file" | "db";
|
|
93
|
+
savedTo: string | null;
|
|
94
|
+
}
|
|
95
|
+
type ChangeOp = "toDb" | "toFile" | "deleteDb" | "deleteFile";
|
|
96
|
+
interface Change {
|
|
97
|
+
key: string;
|
|
98
|
+
op: ChangeOp;
|
|
99
|
+
}
|
|
100
|
+
interface FieldChange {
|
|
101
|
+
path: string;
|
|
102
|
+
from: unknown;
|
|
103
|
+
to: unknown;
|
|
104
|
+
}
|
|
105
|
+
interface HistoryEntry {
|
|
106
|
+
kind: "wip" | "commit";
|
|
107
|
+
sha: string | null;
|
|
108
|
+
head: boolean;
|
|
109
|
+
subject: string | null;
|
|
110
|
+
author: string | null;
|
|
111
|
+
date: string;
|
|
112
|
+
path: string;
|
|
113
|
+
renamedFrom?: string;
|
|
114
|
+
event?: "created" | "deleted";
|
|
115
|
+
unreadable?: boolean;
|
|
116
|
+
changes: FieldChange[];
|
|
117
|
+
record: Rec | null;
|
|
118
|
+
}
|
|
119
|
+
type HistoryPage = {
|
|
120
|
+
state: "nogit" | "untracked";
|
|
121
|
+
} | {
|
|
122
|
+
state: "error";
|
|
123
|
+
message: string;
|
|
124
|
+
} | {
|
|
125
|
+
state: "ok";
|
|
126
|
+
entries: HistoryEntry[];
|
|
127
|
+
next: string | null;
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/config.d.ts
|
|
131
|
+
interface TableInput {
|
|
132
|
+
name: string;
|
|
133
|
+
path?: string;
|
|
134
|
+
files?: string;
|
|
135
|
+
key?: string;
|
|
136
|
+
body?: string;
|
|
137
|
+
columns?: Record<string, string>;
|
|
138
|
+
formats?: Record<string, string>;
|
|
139
|
+
indexes?: unknown[];
|
|
140
|
+
references?: Record<string, unknown>;
|
|
141
|
+
values?: unknown;
|
|
142
|
+
required?: unknown;
|
|
143
|
+
min?: unknown;
|
|
144
|
+
max?: unknown;
|
|
145
|
+
expand?: Record<string, unknown>;
|
|
146
|
+
group?: string;
|
|
147
|
+
split?: string;
|
|
148
|
+
}
|
|
149
|
+
interface OpenOptions {
|
|
150
|
+
root?: string;
|
|
151
|
+
db?: string;
|
|
152
|
+
tables?: TableInput[];
|
|
153
|
+
stateDir?: string;
|
|
154
|
+
persistConfig?: boolean;
|
|
155
|
+
configText?: string;
|
|
156
|
+
}
|
|
157
|
+
declare const CONFIG_NAMES: string[];
|
|
158
|
+
type TableLocation = {
|
|
159
|
+
kind: "file";
|
|
160
|
+
path: string;
|
|
161
|
+
} | {
|
|
162
|
+
kind: "files";
|
|
163
|
+
base: string;
|
|
164
|
+
glob: string;
|
|
165
|
+
captures: Capture[];
|
|
166
|
+
} | {
|
|
167
|
+
kind: "default";
|
|
168
|
+
};
|
|
169
|
+
type DeclaredTable = Omit<TableSpec, "path" | "mode" | "glob" | "captures" | "persisted" | "exclude"> & {
|
|
170
|
+
location: TableLocation;
|
|
171
|
+
};
|
|
172
|
+
interface Config {
|
|
173
|
+
tables: DeclaredTable[];
|
|
174
|
+
pages: PageSpec[];
|
|
175
|
+
}
|
|
176
|
+
declare function readsFile(l: TableLocation, file: string): boolean;
|
|
177
|
+
declare function parseConfig(text: string, name?: string): Config;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/reconcile.d.ts
|
|
180
|
+
interface BaseHashes {
|
|
181
|
+
f: string | null;
|
|
182
|
+
d: string | null;
|
|
183
|
+
}
|
|
184
|
+
type Action = "none" | "base" | "drop" | "toDb" | "toFile";
|
|
185
|
+
interface Decision {
|
|
186
|
+
key: string;
|
|
187
|
+
action: Action;
|
|
188
|
+
conflict?: "file" | "db";
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/plan.d.ts
|
|
192
|
+
interface Registered {
|
|
193
|
+
column: string;
|
|
194
|
+
type: ColumnType;
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/engine.d.ts
|
|
198
|
+
interface TableResult {
|
|
199
|
+
table: string;
|
|
200
|
+
records: number;
|
|
201
|
+
changes: Change[];
|
|
202
|
+
schema: SchemaChange[];
|
|
203
|
+
registered: Registered[];
|
|
204
|
+
ok: boolean;
|
|
205
|
+
error?: string;
|
|
206
|
+
busy?: boolean;
|
|
207
|
+
toDb: number;
|
|
208
|
+
toFile: number;
|
|
209
|
+
deletedDb: number;
|
|
210
|
+
deletedFile: number;
|
|
211
|
+
conflicts: ConflictInfo[];
|
|
212
|
+
warnings: string[];
|
|
213
|
+
decisions?: Decision[];
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/watch.d.ts
|
|
217
|
+
interface WatchHandlers {
|
|
218
|
+
onSync?: (result: TableResult) => void;
|
|
219
|
+
onConflict?: (conflict: ConflictInfo) => void;
|
|
220
|
+
onError?: (error: Error, table?: string) => void;
|
|
221
|
+
onReload?: (tables: string[]) => void;
|
|
222
|
+
}
|
|
223
|
+
interface WatchOptions {
|
|
224
|
+
pollMs?: number;
|
|
225
|
+
debounceMs?: number;
|
|
226
|
+
}
|
|
227
|
+
interface Watcher {
|
|
228
|
+
readonly ready: Promise<void>;
|
|
229
|
+
reloadConfig(): void;
|
|
230
|
+
close(): Promise<void>;
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/check.d.ts
|
|
234
|
+
interface CheckTable {
|
|
235
|
+
table: string;
|
|
236
|
+
ok: boolean;
|
|
237
|
+
error?: string;
|
|
238
|
+
warnings: string[];
|
|
239
|
+
unregistered: Registered[];
|
|
240
|
+
}
|
|
241
|
+
interface CheckResult {
|
|
242
|
+
ok: boolean;
|
|
243
|
+
tables: CheckTable[];
|
|
244
|
+
unregisteredTables: string[];
|
|
245
|
+
}
|
|
246
|
+
declare function check(opts: {
|
|
247
|
+
root: string;
|
|
248
|
+
tables?: string[];
|
|
249
|
+
}): Promise<CheckResult>;
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/export.d.ts
|
|
252
|
+
interface ExportOptions {
|
|
253
|
+
root: string;
|
|
254
|
+
out: string;
|
|
255
|
+
tables?: string[];
|
|
256
|
+
force?: boolean;
|
|
257
|
+
uiDir?: string;
|
|
258
|
+
now?: () => Date;
|
|
259
|
+
}
|
|
260
|
+
interface ExportResult {
|
|
261
|
+
out: string;
|
|
262
|
+
tables: string[];
|
|
263
|
+
warnings: Record<string, string[]>;
|
|
264
|
+
pages: string[];
|
|
265
|
+
skippedPages: Record<string, string>;
|
|
266
|
+
}
|
|
267
|
+
declare function exportSite(opts: ExportOptions): Promise<ExportResult>;
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/init.d.ts
|
|
270
|
+
interface InitOptions {
|
|
271
|
+
root: string;
|
|
272
|
+
db?: string;
|
|
273
|
+
force?: boolean;
|
|
274
|
+
}
|
|
275
|
+
declare function generateConfig(opts: InitOptions): string;
|
|
276
|
+
declare function init(opts: InitOptions): {
|
|
277
|
+
path: string;
|
|
278
|
+
tables: string[];
|
|
279
|
+
};
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/query.d.ts
|
|
282
|
+
interface QueryResult {
|
|
283
|
+
columns: string[];
|
|
284
|
+
rows: DbValue[][];
|
|
285
|
+
truncated: boolean;
|
|
286
|
+
warnings: string[];
|
|
287
|
+
}
|
|
288
|
+
interface QueryOptions {
|
|
289
|
+
root?: string;
|
|
290
|
+
db?: string;
|
|
291
|
+
sql: string;
|
|
292
|
+
limit?: number;
|
|
293
|
+
}
|
|
294
|
+
declare function query(opts: QueryOptions): Promise<QueryResult>;
|
|
295
|
+
declare function formatTable(r: QueryResult): string;
|
|
296
|
+
declare function formatJson(r: QueryResult): string;
|
|
297
|
+
declare function formatCsv(r: QueryResult): string;
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/index.d.ts
|
|
300
|
+
interface Yamlite {
|
|
301
|
+
readonly tables: readonly TableSpec[];
|
|
302
|
+
readonly pages: readonly PageSpec[];
|
|
303
|
+
status(opts?: {
|
|
304
|
+
tables?: string[];
|
|
305
|
+
}): Promise<TableResult[]>;
|
|
306
|
+
sync(opts?: {
|
|
307
|
+
tables?: string[];
|
|
308
|
+
force?: boolean;
|
|
309
|
+
forceConvert?: boolean;
|
|
310
|
+
}): Promise<TableResult[]>;
|
|
311
|
+
watch(handlers?: WatchHandlers, options?: WatchOptions): Watcher;
|
|
312
|
+
close(): Promise<void>;
|
|
313
|
+
}
|
|
314
|
+
declare function open(options: OpenOptions): Promise<Yamlite>;
|
|
315
|
+
//#endregion
|
|
316
|
+
export { parseConfig as A, HistoryEntry as B, Decision as C, OpenOptions as D, DeclaredTable as E, ColumnType as F, Rec as G, IndexSpec as H, ConflictInfo as I, ViewRecord as J, SchemaChange as K, DbRow as L, Capture as M, Change as N, TableInput as O, ChangeOp as P, DbValue as R, BaseHashes as S, Config as T, PageAccess as U, HistoryPage as V, PageSpec as W, check as _, formatCsv as a, Watcher as b, query as c, init as d, ExportOptions as f, CheckTable as g, CheckResult as h, QueryResult as i, readsFile as j, TableLocation as k, InitOptions as l, exportSite as m, open as n, formatJson as o, ExportResult as p, TableSpec as q, QueryOptions as r, formatTable as s, Yamlite as t, generateConfig as u, WatchHandlers as v, CONFIG_NAMES as w, TableResult as x, WatchOptions as y, FieldChange as z };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as Decision, D as OpenOptions, F as ColumnType, H as IndexSpec, I as ConflictInfo, K as SchemaChange, N as Change, O as TableInput, P as ChangeOp, W as PageSpec, _ as check, a as formatCsv, b as Watcher, c as query, d as init, f as ExportOptions, g as CheckTable, h as CheckResult, i as QueryResult, l as InitOptions, m as exportSite, n as open, o as formatJson, p as ExportResult, q as TableSpec, r as QueryOptions, s as formatTable, t as Yamlite, u as generateConfig, v as WatchHandlers, x as TableResult, y as WatchOptions } from "./index-BBHZ8yok.mjs";
|
|
2
|
+
export { type Change, type ChangeOp, type CheckResult, type CheckTable, type ColumnType, type ConflictInfo, type Decision, type ExportOptions, type ExportResult, type IndexSpec, type InitOptions, type OpenOptions, type PageSpec, type QueryOptions, type QueryResult, type SchemaChange, type TableInput, type TableResult, type TableSpec, type WatchHandlers, type WatchOptions, type Watcher, Yamlite, check, exportSite, formatCsv, formatJson, formatTable, generateConfig, init, open, query };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { R as check, c as exportSite, n as formatCsv, r as formatJson, i as formatTable, o as generateConfig, s as init, t as open, a as query } from "./src-DKu7thkC.mjs";
|