@kedem/okdb 2.3.4 → 2.4.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +366 -0
  2. package/algorithm-worker-thread.js +1 -1
  3. package/bin/okdb.js +1 -1
  4. package/docs/auth-and-sync.md +28 -4
  5. package/docs/auth-permissions.md +19 -6
  6. package/docs/change-log.md +79 -59
  7. package/docs/data-model.md +20 -18
  8. package/docs/deployment.md +25 -0
  9. package/docs/diagnostics.md +59 -17
  10. package/docs/embeddings.md +57 -6
  11. package/docs/files.md +1 -1
  12. package/docs/fts.md +50 -5
  13. package/docs/functions.md +21 -8
  14. package/docs/http-api.md +139 -98
  15. package/docs/http-cluster.md +30 -8
  16. package/docs/indexes.md +5 -4
  17. package/docs/logging.md +18 -0
  18. package/docs/migration.md +94 -2
  19. package/docs/pipelines.md +6 -1
  20. package/docs/plugins.md +12 -18
  21. package/docs/process-registry.md +50 -39
  22. package/docs/processors.md +40 -22
  23. package/docs/querying.md +50 -36
  24. package/docs/queue.md +110 -14
  25. package/docs/subscriptions.md +35 -24
  26. package/docs/sync.md +96 -37
  27. package/docs/time-machine.md +23 -17
  28. package/docs/transactions.md +11 -19
  29. package/docs/ttl.md +118 -67
  30. package/docs/upgrade-2.0.md +2 -2
  31. package/docs/views.md +71 -52
  32. package/okdb-functions-sandbox-worker.js +1 -1
  33. package/okdb-http-worker-child.js +1 -1
  34. package/okdb-views-bootstrap-worker.js +1 -1
  35. package/okdb.js +1 -1
  36. package/package.json +1 -1
  37. package/public/sections/db/parts/type-viewer.ok.js +1 -1
  38. package/public/sections/embeddings/parts/engines-overview.ok.js +1 -1
  39. package/public/sections/queue/parts/queue-jobs.ok.js +1 -1
  40. package/public/sections/system/modals/data-ops-modal.ok.js +1 -1
  41. package/types/environment.d.ts +320 -52
  42. package/types/features/admin.d.ts +8 -2
  43. package/types/features/api.d.ts +10 -16
  44. package/types/features/auth.d.ts +135 -16
  45. package/types/features/embeddings.d.ts +639 -31
  46. package/types/features/engines.d.ts +368 -14
  47. package/types/features/files.d.ts +2 -4
  48. package/types/features/fts.d.ts +98 -26
  49. package/types/features/functions.d.ts +175 -15
  50. package/types/features/mcp.d.ts +23 -10
  51. package/types/features/pipelines.d.ts +268 -9
  52. package/types/features/queue.d.ts +230 -34
  53. package/types/features/sync.d.ts +177 -14
  54. package/types/features/time-machine.d.ts +117 -16
  55. package/types/features/views.d.ts +230 -39
  56. package/types/index.d.ts +357 -254
  57. package/types/okdb.d.ts +377 -0
  58. package/types/options.d.ts +309 -48
  59. package/public/test-cron-input.html +0 -60
  60. package/public/test-json-input.html +0 -280
@@ -1,280 +0,0 @@
1
- <!DOCTYPE html>
2
- <!--
3
- Standalone smoke-test for ok-json-input schema-driven completions.
4
-
5
- ROOT CAUSE of invisible labels (type-viewer):
6
- Monaco's fixedOverflowWidgets:true moves the suggest/hover widgets to
7
- <body> inside a SEPARATE .monaco-editor.vs-dark container. Monaco sets
8
- its colour palette as INLINE custom-properties on the MAIN editor element
9
- only — the overflow container never gets them. Every var(--vscode-…)
10
- inside the widget therefore falls back to `initial` (black text on dark
11
- background → invisible).
12
-
13
- FIX:
14
- Declare the same custom-properties in a stylesheet rule that targets
15
- .monaco-editor.vs-dark so they cascade into the overflow container.
16
- See the <style> block below — the identical block is in styles.css for
17
- the real admin app.
18
- -->
19
- <html lang="en">
20
- <head>
21
- <meta charset="UTF-8">
22
- <title>ok-json-input — completion test</title>
23
- <script type="importmap">
24
- {
25
- "imports": {
26
- "@toolkit/": "./vendor/okjs/toolkit/",
27
- "@okjs": "./vendor/okjs/ok.esm.min.js"
28
- }
29
- }
30
- </script>
31
- <style>
32
- /* ── page chrome ────────────────────────────────────────────── */
33
- *, *::before, *::after { box-sizing: border-box; }
34
-
35
- body {
36
- margin: 0;
37
- padding: 24px;
38
- background: #161c20;
39
- color: #d0d8e0;
40
- font-family: 'Segoe UI', Arial, sans-serif;
41
- font-size: 13px;
42
- line-height: 1.6;
43
- }
44
-
45
- h2 { margin: 0 0 4px; font-size: 15px; color: #e0eaf4; }
46
- p { margin: 0 0 12px; opacity: .55; font-size: 12px; }
47
-
48
- .card {
49
- background: #1a2228;
50
- border: 1px solid #23292e;
51
- border-radius: 10px;
52
- padding: 16px 18px;
53
- margin-bottom: 20px;
54
- }
55
-
56
- label {
57
- display: block;
58
- font-size: 11px;
59
- opacity: .5;
60
- margin-bottom: 6px;
61
- text-transform: uppercase;
62
- letter-spacing: .04em;
63
- }
64
-
65
- .result {
66
- margin-top: 10px;
67
- background: #0d1318;
68
- border: 1px solid #1e2e3e;
69
- border-radius: 7px;
70
- padding: 8px 12px;
71
- font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
72
- font-size: 12px;
73
- color: #4FC1FF;
74
- min-height: 24px;
75
- white-space: pre-wrap;
76
- word-break: break-all;
77
- }
78
-
79
- .badge {
80
- display: inline-block;
81
- padding: 2px 8px;
82
- border-radius: 4px;
83
- font-size: 11px;
84
- font-weight: 600;
85
- }
86
- .badge-ok { background: #0d2e1a; color: #3dbb6a; border: 1px solid #1e4a2a; }
87
- .badge-err { background: #2e0d0d; color: #bb3d3d; border: 1px solid #4a1e1e; }
88
-
89
- /* ── Monaco overflow widget fix ─────────────────────────────── */
90
- /*
91
- * The suggest/hover widgets rendered at body level live in their own
92
- * .monaco-editor.vs-dark wrapper which does NOT inherit Monaco's inline
93
- * --vscode-* custom properties. Defining them here (in a stylesheet)
94
- * makes them cascade into the overflow containers so labels are visible.
95
- */
96
- .monaco-editor.vs-dark {
97
- /* Suggest widget */
98
- --vscode-editorSuggestWidget-background: #252526;
99
- --vscode-editorSuggestWidget-foreground: #d4d4d4;
100
- --vscode-editorSuggestWidget-selectedForeground: #d4d4d4;
101
- --vscode-editorSuggestWidget-selectedBackground: #04395e;
102
- --vscode-editorSuggestWidget-highlightForeground: #18a3ff;
103
- --vscode-editorSuggestWidget-focusHighlightForeground: #18a3ff;
104
- --vscode-editorSuggestWidget-border: #454545;
105
-
106
- /* List / tree (used inside suggest + picker widgets) */
107
- --vscode-list-foreground: #d4d4d4;
108
- --vscode-list-hoverBackground: #2a2d2e;
109
- --vscode-list-hoverForeground: #d4d4d4;
110
- --vscode-list-focusBackground: #062f4a;
111
- --vscode-list-focusForeground: #d4d4d4;
112
- --vscode-list-activeSelectionBackground: #04395e;
113
- --vscode-list-activeSelectionForeground: #d4d4d4;
114
- --vscode-list-inactiveSelectionBackground: #37373d;
115
- --vscode-list-inactiveSelectionForeground: #d4d4d4;
116
- --vscode-list-highlightForeground: #18a3ff;
117
-
118
- /* Hover / parameter hints widget */
119
- --vscode-editorHoverWidget-background: #252526;
120
- --vscode-editorHoverWidget-foreground: #d4d4d4;
121
- --vscode-editorHoverWidget-border: #454545;
122
- --vscode-editorHoverWidget-statusBarBackground: #2c2c2d;
123
- }
124
- </style>
125
- </head>
126
- <body>
127
-
128
- <!-- ─── Card 1: textbox with sift-style schema ──────────────────────────── -->
129
- <div class="card">
130
- <h2>Filter query <span style="opacity:.4;font-weight:400;font-size:12px;">— textbox, schema completions</span></h2>
131
- <p>
132
- Type <code style="color:#4FC1FF">{</code> then <kbd>Ctrl+Space</kbd> to open completions.
133
- Schema fields: <code style="color:#4FC1FF">name</code> (string),
134
- <code style="color:#4FC1FF">age</code> (number),
135
- <code style="color:#4FC1FF">active</code> (boolean).
136
- </p>
137
- <label>Value</label>
138
- <ok-json-input
139
- id="filter-input"
140
- style="min-height: 80px; display:flex; flex:1;"
141
- :schema="filterSchema"
142
- ></ok-json-input>
143
- <div style="margin-top:8px; display:flex; align-items:center; gap:8px;">
144
- <span id="filter-badge" class="badge badge-ok">—</span>
145
- <span style="opacity:.4; font-size:11px;">last valid value:</span>
146
- </div>
147
- <div id="filter-result" class="result">—</div>
148
- </div>
149
-
150
- <!-- ─── Card 2: single-line input mode ──────────────────────────────────── -->
151
- <div class="card">
152
- <h2>Prefix value <span style="opacity:.4;font-weight:400;font-size:12px;">— input mode (no schema)</span></h2>
153
- <p>Single-line mode. Press Enter to commit, Shift+Enter to add a newline.</p>
154
- <label>Value</label>
155
- <ok-json-input
156
- id="prefix-input"
157
- mode="input"
158
- style="width: 280px;"
159
- ></ok-json-input>
160
- <div id="prefix-result" class="result">—</div>
161
- </div>
162
-
163
- <!-- ─── Card 3: schema with $or / logical operators ─────────────────────── -->
164
- <div class="card">
165
- <h2>Logical query <span style="opacity:.4;font-weight:400;font-size:12px;">— textbox, richer schema</span></h2>
166
- <p>
167
- Schema exposes <code style="color:#4FC1FF">$and</code>, <code style="color:#4FC1FF">$or</code>, <code style="color:#4FC1FF">$nor</code>
168
- at the top level in addition to field names.
169
- Try typing <code style="color:#4FC1FF">"$</code> and pressing Ctrl+Space.
170
- </p>
171
- <label>Value</label>
172
- <ok-json-input
173
- id="logical-input"
174
- style="min-height: 110px; display:flex; flex:1;"
175
- :schema="logicalSchema"
176
- ></ok-json-input>
177
- <div id="logical-result" class="result">—</div>
178
- </div>
179
-
180
- <script type="module">
181
- import OK from '@okjs';
182
- import okJsonInput from './components/ok-json-input.ok.js';
183
-
184
- // ── bootstrap ok.js ─────────────────────────────────────────────────────
185
- const ok = OK({ env: 'dev', crash: { mode: 'debug' } });
186
-
187
- ok.register(okJsonInput);
188
-
189
- // ── schemas ─────────────────────────────────────────────────────────────
190
-
191
- /** Operator sub-schema used for each field */
192
- const operatorProps = {
193
- $eq: { description: 'Equals this value exactly' },
194
- $ne: { description: 'Not equal' },
195
- $gt: { description: 'Greater than' },
196
- $gte: { description: 'Greater than or equal' },
197
- $lt: { description: 'Less than' },
198
- $lte: { description: 'Less than or equal' },
199
- $in: { type: 'array', items: {}, description: 'Value in array e.g. {"$in":["a","b"]}' },
200
- $nin: { type: 'array', items: {}, description: 'Value NOT in array' },
201
- $exists: { type: 'boolean', enum: [true, false], description: 'Field presence' },
202
- $regex: { type: 'string', description: 'Regular-expression pattern' },
203
- };
204
-
205
- const fieldValue = (desc) => ({
206
- description: desc,
207
- oneOf: [
208
- { description: 'Direct value match' },
209
- {
210
- type: 'object',
211
- description: 'Operator object',
212
- properties: operatorProps,
213
- additionalProperties: false,
214
- },
215
- ],
216
- });
217
-
218
- /** Schema for Cards 1 — simple 3-field sift filter */
219
- const filterSchema = {
220
- type: 'object',
221
- description: 'Sift-compatible filter query',
222
- properties: {
223
- name: fieldValue('"name" (string)'),
224
- age: fieldValue('"age" (number)'),
225
- active: fieldValue('"active" (boolean)'),
226
- },
227
- additionalProperties: false,
228
- };
229
-
230
- /** Schema for Card 3 — logical operators at the top level */
231
- const logicalSchema = {
232
- type: 'object',
233
- description: 'Sift-compatible filter query (with logical operators)',
234
- properties: {
235
- name: fieldValue('"name" (string)'),
236
- age: fieldValue('"age" (number)'),
237
- active: fieldValue('"active" (boolean)'),
238
- $and: { type: 'array', items: { type: 'object' }, description: 'All conditions must match' },
239
- $or: { type: 'array', items: { type: 'object' }, description: 'At least one condition must match' },
240
- $nor: { type: 'array', items: { type: 'object' }, description: 'No condition must match' },
241
- },
242
- additionalProperties: false,
243
- };
244
-
245
- // ── init ─────────────────────────────────────────────────────────────────
246
- await ok.init(document.body, {
247
- filterSchema,
248
- logicalSchema,
249
- });
250
-
251
- // ── wire up change events ────────────────────────────────────────────────
252
- function showResult(inputId, resultId, badgeId) {
253
- const el = document.getElementById(inputId);
254
- const result = document.getElementById(resultId);
255
- const badge = badgeId ? document.getElementById(badgeId) : null;
256
-
257
- el.addEventListener('edit', e => {
258
- const val = e.detail;
259
- if (val === undefined) {
260
- result.textContent = '— (invalid JSON) —';
261
- if (badge) { badge.textContent = 'invalid'; badge.className = 'badge badge-err'; }
262
- } else {
263
- result.textContent = JSON.stringify(val, null, 2);
264
- if (badge) { badge.textContent = 'valid ✓'; badge.className = 'badge badge-ok'; }
265
- }
266
- });
267
-
268
- el.addEventListener('change', e => {
269
- const val = e.detail;
270
- result.textContent = '▶ committed: ' + JSON.stringify(val, null, 2);
271
- });
272
- }
273
-
274
- showResult('filter-input', 'filter-result', 'filter-badge');
275
- showResult('prefix-input', 'prefix-result', null);
276
- showResult('logical-input', 'logical-result', null);
277
- </script>
278
- </body>
279
- </html>
280
-