@silverbulletmd/silverbullet 2.5.3 → 2.6.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 -5
- package/client/asset_bundle/bundle.ts +3 -9
- package/client/data/datastore.ts +4 -5
- package/client/markdown_parser/constants.ts +3 -2
- package/client/plugos/hooks/code_widget.ts +3 -5
- package/client/plugos/hooks/command.ts +8 -8
- package/client/plugos/hooks/document_editor.ts +10 -12
- package/client/plugos/hooks/event.ts +33 -36
- package/client/plugos/hooks/mq.ts +17 -17
- package/client/plugos/hooks/plug_namespace.ts +3 -5
- package/client/plugos/hooks/slash_command.ts +12 -27
- package/client/plugos/hooks/syscall.ts +3 -3
- package/client/plugos/manifest_cache.ts +22 -15
- package/client/plugos/plug.ts +2 -5
- package/client/plugos/plug_compile.ts +67 -65
- package/client/plugos/protocol.ts +28 -28
- package/client/plugos/proxy_fetch.ts +7 -6
- package/client/plugos/sandboxes/worker_sandbox.ts +16 -15
- package/client/plugos/syscalls/asset.ts +1 -3
- package/client/plugos/syscalls/code_widget.ts +1 -3
- package/client/plugos/syscalls/config.ts +1 -5
- package/client/plugos/syscalls/datastore.ts +1 -1
- package/client/plugos/syscalls/editor.ts +63 -60
- package/client/plugos/syscalls/event.ts +9 -12
- package/client/plugos/syscalls/fetch.ts +30 -22
- package/client/plugos/syscalls/index.ts +10 -1
- package/client/plugos/syscalls/jsonschema.ts +72 -32
- package/client/plugos/syscalls/language.ts +9 -5
- package/client/plugos/syscalls/markdown.ts +29 -7
- package/client/plugos/syscalls/mq.ts +3 -11
- package/client/plugos/syscalls/service_registry.ts +1 -4
- package/client/plugos/syscalls/shell.ts +2 -5
- package/client/plugos/syscalls/sync.ts +69 -60
- package/client/plugos/syscalls/system.ts +2 -3
- package/client/plugos/system.ts +4 -10
- package/client/plugos/worker_runtime.ts +4 -3
- package/client/space_lua/aggregates.ts +632 -59
- package/client/space_lua/ast.ts +21 -9
- package/client/space_lua/ast_narrow.ts +4 -2
- package/client/space_lua/eval.ts +842 -536
- package/client/space_lua/labels.ts +6 -11
- package/client/space_lua/liq_null.ts +6 -0
- package/client/space_lua/numeric.ts +5 -8
- package/client/space_lua/parse.ts +290 -169
- package/client/space_lua/query_collection.ts +213 -149
- package/client/space_lua/render_lua_markdown.ts +369 -0
- package/client/space_lua/rp.ts +5 -4
- package/client/space_lua/runtime.ts +245 -142
- package/client/space_lua/stdlib/format.ts +34 -20
- package/client/space_lua/stdlib/js.ts +3 -7
- package/client/space_lua/stdlib/load.ts +1 -3
- package/client/space_lua/stdlib/math.ts +15 -14
- package/client/space_lua/stdlib/net.ts +25 -15
- package/client/space_lua/stdlib/os.ts +76 -85
- package/client/space_lua/stdlib/pattern.ts +28 -35
- package/client/space_lua/stdlib/prng.ts +15 -12
- package/client/space_lua/stdlib/space_lua.ts +16 -17
- package/client/space_lua/stdlib/string.ts +7 -17
- package/client/space_lua/stdlib/string_pack.ts +23 -19
- package/client/space_lua/stdlib/table.ts +5 -9
- package/client/space_lua/stdlib.ts +20 -30
- package/client/space_lua/tonumber.ts +79 -40
- package/client/space_lua/util.ts +14 -10
- package/dist/plug-compile.js +44 -41
- package/package.json +24 -22
- package/plug-api/lib/async.ts +19 -6
- package/plug-api/lib/crypto.ts +5 -6
- package/plug-api/lib/dates.ts +15 -7
- package/plug-api/lib/json.ts +10 -4
- package/plug-api/lib/ref.ts +18 -18
- package/plug-api/lib/resolve.ts +7 -11
- package/plug-api/lib/tags.ts +13 -4
- package/plug-api/lib/transclusion.ts +6 -17
- package/plug-api/lib/tree.ts +115 -43
- package/plug-api/lib/yaml.ts +25 -15
- package/plug-api/syscalls/asset.ts +1 -1
- package/plug-api/syscalls/config.ts +1 -4
- package/plug-api/syscalls/editor.ts +14 -14
- package/plug-api/syscalls/jsonschema.ts +1 -3
- package/plug-api/syscalls/lua.ts +3 -9
- package/plug-api/syscalls/mq.ts +1 -4
- package/plug-api/syscalls/shell.ts +4 -1
- package/plug-api/syscalls/space.ts +3 -10
- package/plug-api/syscalls/system.ts +1 -4
- package/plug-api/syscalls/yaml.ts +2 -6
- package/plug-api/types/client.ts +16 -1
- package/plug-api/types/event.ts +6 -4
- package/plug-api/types/manifest.ts +8 -9
- package/plugs/builtin_plugs.ts +2 -2
- package/dist/worker_runtime_bundle.js +0 -233
package/client/space_lua/ast.ts
CHANGED
|
@@ -176,7 +176,8 @@ export type LuaExpression =
|
|
|
176
176
|
| LuaTableConstructor
|
|
177
177
|
| LuaFunctionDefinition
|
|
178
178
|
| LuaQueryExpression
|
|
179
|
-
| LuaFilteredCallExpression
|
|
179
|
+
| LuaFilteredCallExpression
|
|
180
|
+
| LuaAggregateCallExpression;
|
|
180
181
|
|
|
181
182
|
export type LuaNilLiteral = {
|
|
182
183
|
type: "Nil";
|
|
@@ -235,6 +236,7 @@ export type LuaFunctionCallExpression = {
|
|
|
235
236
|
prefix: LuaPrefixExpression;
|
|
236
237
|
name?: string;
|
|
237
238
|
args: LuaExpression[];
|
|
239
|
+
orderBy?: LuaOrderBy[];
|
|
238
240
|
} & ASTContext;
|
|
239
241
|
|
|
240
242
|
export type LuaBinaryExpression = {
|
|
@@ -255,10 +257,7 @@ export type LuaTableConstructor = {
|
|
|
255
257
|
fields: LuaTableField[];
|
|
256
258
|
} & ASTContext;
|
|
257
259
|
|
|
258
|
-
export type LuaTableField =
|
|
259
|
-
| LuaDynamicField
|
|
260
|
-
| LuaPropField
|
|
261
|
-
| LuaExpressionField;
|
|
260
|
+
export type LuaTableField = LuaDynamicField | LuaPropField | LuaExpressionField;
|
|
262
261
|
|
|
263
262
|
export type LuaDynamicField = {
|
|
264
263
|
type: "DynamicField";
|
|
@@ -289,6 +288,13 @@ export type LuaFilteredCallExpression = {
|
|
|
289
288
|
filter: LuaExpression;
|
|
290
289
|
} & ASTContext;
|
|
291
290
|
|
|
291
|
+
// Aggregate call with intra-aggregate order by
|
|
292
|
+
export type LuaAggregateCallExpression = {
|
|
293
|
+
type: "AggregateCall";
|
|
294
|
+
call: LuaFunctionCallExpression;
|
|
295
|
+
orderBy: LuaOrderBy[];
|
|
296
|
+
} & ASTContext;
|
|
297
|
+
|
|
292
298
|
// Query stuff
|
|
293
299
|
export type LuaQueryExpression = {
|
|
294
300
|
type: "Query";
|
|
@@ -299,15 +305,16 @@ export type LuaQueryClause =
|
|
|
299
305
|
| LuaFromClause
|
|
300
306
|
| LuaWhereClause
|
|
301
307
|
| LuaLimitClause
|
|
308
|
+
| LuaOffsetClause
|
|
302
309
|
| LuaOrderByClause
|
|
303
310
|
| LuaSelectClause
|
|
304
311
|
| LuaGroupByClause
|
|
305
312
|
| LuaHavingClause;
|
|
306
313
|
|
|
314
|
+
// Field list used by `from`, `select` and `group by` clauses
|
|
307
315
|
export type LuaFromClause = {
|
|
308
316
|
type: "From";
|
|
309
|
-
|
|
310
|
-
expression: LuaExpression;
|
|
317
|
+
fields: LuaTableField[];
|
|
311
318
|
} & ASTContext;
|
|
312
319
|
|
|
313
320
|
export type LuaWhereClause = {
|
|
@@ -321,6 +328,11 @@ export type LuaLimitClause = {
|
|
|
321
328
|
offset?: LuaExpression;
|
|
322
329
|
} & ASTContext;
|
|
323
330
|
|
|
331
|
+
export type LuaOffsetClause = {
|
|
332
|
+
type: "Offset";
|
|
333
|
+
offset: LuaExpression;
|
|
334
|
+
} & ASTContext;
|
|
335
|
+
|
|
324
336
|
export type LuaOrderByClause = {
|
|
325
337
|
type: "OrderBy";
|
|
326
338
|
orderBy: LuaOrderBy[];
|
|
@@ -336,12 +348,12 @@ export type LuaOrderBy = {
|
|
|
336
348
|
|
|
337
349
|
export type LuaSelectClause = {
|
|
338
350
|
type: "Select";
|
|
339
|
-
|
|
351
|
+
fields: LuaTableField[];
|
|
340
352
|
} & ASTContext;
|
|
341
353
|
|
|
342
354
|
export type LuaGroupByClause = {
|
|
343
355
|
type: "GroupBy";
|
|
344
|
-
|
|
356
|
+
fields: LuaTableField[];
|
|
345
357
|
} & ASTContext;
|
|
346
358
|
|
|
347
359
|
export type LuaHavingClause = {
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
import type { ASTCtx, LuaExpression, LuaLValue, LuaStatement } from "./ast.ts";
|
|
4
4
|
|
|
5
5
|
// Extract by `type` discriminant
|
|
6
|
-
type NarrowByType<
|
|
7
|
-
|
|
6
|
+
type NarrowByType<
|
|
7
|
+
U,
|
|
8
|
+
K extends U extends { type: infer T } ? T : never,
|
|
9
|
+
> = Extract<U, { type: K }>;
|
|
8
10
|
|
|
9
11
|
// Expressions
|
|
10
12
|
export const asStringExpr = (e: LuaExpression) =>
|