@rcrsr/rill 0.16.0 → 0.17.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 (57) hide show
  1. package/README.md +37 -21
  2. package/dist/ext/crypto/index.d.ts +3 -3
  3. package/dist/ext/crypto/index.js +61 -58
  4. package/dist/ext/exec/index.d.ts +3 -3
  5. package/dist/ext/exec/index.js +14 -8
  6. package/dist/ext/fetch/index.d.ts +3 -3
  7. package/dist/ext/fetch/index.js +16 -11
  8. package/dist/ext/fs/index.d.ts +3 -3
  9. package/dist/ext/fs/index.js +242 -239
  10. package/dist/ext/kv/index.d.ts +3 -3
  11. package/dist/ext/kv/index.js +197 -195
  12. package/dist/ext/kv/store.js +2 -1
  13. package/dist/ext-parse-bridge.d.ts +10 -0
  14. package/dist/ext-parse-bridge.js +10 -0
  15. package/dist/generated/introspection-data.d.ts +1 -1
  16. package/dist/generated/introspection-data.js +385 -296
  17. package/dist/generated/version-data.d.ts +1 -1
  18. package/dist/generated/version-data.js +2 -2
  19. package/dist/index.d.ts +15 -4
  20. package/dist/index.js +14 -5
  21. package/dist/parser/parser-types.js +12 -0
  22. package/dist/parser/parser-use.js +7 -1
  23. package/dist/runtime/core/callable.d.ts +20 -8
  24. package/dist/runtime/core/callable.js +63 -23
  25. package/dist/runtime/core/context.d.ts +0 -11
  26. package/dist/runtime/core/context.js +76 -75
  27. package/dist/runtime/core/eval/index.d.ts +2 -2
  28. package/dist/runtime/core/eval/index.js +11 -0
  29. package/dist/runtime/core/eval/mixins/closures.js +15 -15
  30. package/dist/runtime/core/eval/mixins/conversion.js +51 -110
  31. package/dist/runtime/core/eval/mixins/core.js +2 -2
  32. package/dist/runtime/core/eval/mixins/expressions.js +35 -27
  33. package/dist/runtime/core/eval/mixins/literals.js +3 -3
  34. package/dist/runtime/core/eval/mixins/types.js +44 -54
  35. package/dist/runtime/core/eval/mixins/variables.js +10 -8
  36. package/dist/runtime/core/field-descriptor.d.ts +3 -3
  37. package/dist/runtime/core/field-descriptor.js +2 -1
  38. package/dist/runtime/core/introspection.js +6 -6
  39. package/dist/runtime/core/markers.d.ts +12 -0
  40. package/dist/runtime/core/markers.js +7 -0
  41. package/dist/runtime/core/type-registrations.d.ts +136 -0
  42. package/dist/runtime/core/type-registrations.js +749 -0
  43. package/dist/runtime/core/type-structures.d.ts +128 -0
  44. package/dist/runtime/core/type-structures.js +12 -0
  45. package/dist/runtime/core/types.d.ts +15 -3
  46. package/dist/runtime/core/values.d.ts +62 -153
  47. package/dist/runtime/core/values.js +308 -524
  48. package/dist/runtime/ext/builtins.js +83 -64
  49. package/dist/runtime/ext/extensions.d.ts +30 -124
  50. package/dist/runtime/ext/extensions.js +0 -93
  51. package/dist/runtime/ext/test-context.d.ts +28 -0
  52. package/dist/runtime/ext/test-context.js +154 -0
  53. package/dist/runtime/index.d.ts +22 -8
  54. package/dist/runtime/index.js +18 -4
  55. package/dist/signature-parser.d.ts +2 -2
  56. package/dist/signature-parser.js +14 -14
  57. package/package.json +1 -1
@@ -7,6 +7,7 @@
7
7
  import fs from 'node:fs/promises';
8
8
  import path from 'node:path';
9
9
  import { RuntimeError } from '../../error-classes.js';
10
+ import { toCallable } from '../../runtime/core/callable.js';
10
11
  import { rillTypeToTypeValue, } from '../../runtime/core/values.js';
11
12
  import { resolvePath, matchesGlob, initializeMount, } from './sandbox.js';
12
13
  export const configSchema = {
@@ -22,7 +23,7 @@ export const configSchema = {
22
23
  * Returns 12 functions: read, write, append, list, find, exists, remove, stat, mkdir, copy, move, mounts.
23
24
  *
24
25
  * @param config - Mount configuration and defaults
25
- * @returns ExtensionResult with 12 filesystem functions
26
+ * @returns ExtensionFactoryResult with 12 filesystem functions
26
27
  * @throws RuntimeError if mount initialization fails
27
28
  *
28
29
  * @example
@@ -412,244 +413,246 @@ export function createFsExtension(config) {
412
413
  // EXTENSION RESULT
413
414
  // ============================================================
414
415
  return {
415
- read: {
416
- params: [
417
- {
418
- name: 'mount',
419
- type: { type: 'string' },
420
- defaultValue: undefined,
421
- annotations: { description: 'Mount name' },
422
- },
423
- {
424
- name: 'path',
425
- type: { type: 'string' },
426
- defaultValue: undefined,
427
- annotations: { description: 'File path relative to mount' },
428
- },
429
- ],
430
- fn: read,
431
- annotations: { description: 'Read file contents' },
432
- returnType: rillTypeToTypeValue({ type: 'string' }),
433
- },
434
- write: {
435
- params: [
436
- {
437
- name: 'mount',
438
- type: { type: 'string' },
439
- defaultValue: undefined,
440
- annotations: { description: 'Mount name' },
441
- },
442
- {
443
- name: 'path',
444
- type: { type: 'string' },
445
- defaultValue: undefined,
446
- annotations: { description: 'File path relative to mount' },
447
- },
448
- {
449
- name: 'content',
450
- type: { type: 'string' },
451
- defaultValue: undefined,
452
- annotations: { description: 'Content to write' },
453
- },
454
- ],
455
- fn: write,
456
- annotations: { description: 'Write file, replacing if exists' },
457
- returnType: rillTypeToTypeValue({ type: 'string' }),
458
- },
459
- append: {
460
- params: [
461
- {
462
- name: 'mount',
463
- type: { type: 'string' },
464
- defaultValue: undefined,
465
- annotations: { description: 'Mount name' },
466
- },
467
- {
468
- name: 'path',
469
- type: { type: 'string' },
470
- defaultValue: undefined,
471
- annotations: { description: 'File path relative to mount' },
472
- },
473
- {
474
- name: 'content',
475
- type: { type: 'string' },
476
- defaultValue: undefined,
477
- annotations: { description: 'Content to append' },
478
- },
479
- ],
480
- fn: append,
481
- annotations: { description: 'Append content to file' },
482
- returnType: rillTypeToTypeValue({ type: 'string' }),
483
- },
484
- list: {
485
- params: [
486
- {
487
- name: 'mount',
488
- type: { type: 'string' },
489
- defaultValue: undefined,
490
- annotations: { description: 'Mount name' },
491
- },
492
- {
493
- name: 'path',
494
- type: { type: 'string' },
495
- defaultValue: '',
496
- annotations: { description: 'Directory path relative to mount' },
497
- },
498
- ],
499
- fn: list,
500
- annotations: { description: 'List directory contents' },
501
- returnType: rillTypeToTypeValue({ type: 'list' }),
502
- },
503
- find: {
504
- params: [
505
- {
506
- name: 'mount',
507
- type: { type: 'string' },
508
- defaultValue: undefined,
509
- annotations: { description: 'Mount name' },
510
- },
511
- {
512
- name: 'pattern',
513
- type: { type: 'string' },
514
- defaultValue: '*',
515
- annotations: { description: 'Glob pattern for filtering' },
516
- },
517
- ],
518
- fn: find,
519
- annotations: { description: 'Recursive file search' },
520
- returnType: rillTypeToTypeValue({ type: 'list' }),
521
- },
522
- exists: {
523
- params: [
524
- {
525
- name: 'mount',
526
- type: { type: 'string' },
527
- defaultValue: undefined,
528
- annotations: { description: 'Mount name' },
529
- },
530
- {
531
- name: 'path',
532
- type: { type: 'string' },
533
- defaultValue: undefined,
534
- annotations: { description: 'File path relative to mount' },
535
- },
536
- ],
537
- fn: exists,
538
- annotations: { description: 'Check file existence' },
539
- returnType: rillTypeToTypeValue({ type: 'bool' }),
540
- },
541
- remove: {
542
- params: [
543
- {
544
- name: 'mount',
545
- type: { type: 'string' },
546
- defaultValue: undefined,
547
- annotations: { description: 'Mount name' },
548
- },
549
- {
550
- name: 'path',
551
- type: { type: 'string' },
552
- defaultValue: undefined,
553
- annotations: { description: 'File path relative to mount' },
554
- },
555
- ],
556
- fn: remove,
557
- annotations: { description: 'Delete file' },
558
- returnType: rillTypeToTypeValue({ type: 'bool' }),
559
- },
560
- stat: {
561
- params: [
562
- {
563
- name: 'mount',
564
- type: { type: 'string' },
565
- defaultValue: undefined,
566
- annotations: { description: 'Mount name' },
567
- },
568
- {
569
- name: 'path',
570
- type: { type: 'string' },
571
- defaultValue: undefined,
572
- annotations: { description: 'File path relative to mount' },
573
- },
574
- ],
575
- fn: stat,
576
- annotations: { description: 'Get file metadata' },
577
- returnType: rillTypeToTypeValue({ type: 'dict' }),
578
- },
579
- mkdir: {
580
- params: [
581
- {
582
- name: 'mount',
583
- type: { type: 'string' },
584
- defaultValue: undefined,
585
- annotations: { description: 'Mount name' },
586
- },
587
- {
588
- name: 'path',
589
- type: { type: 'string' },
590
- defaultValue: undefined,
591
- annotations: { description: 'Directory path relative to mount' },
592
- },
593
- ],
594
- fn: mkdir,
595
- annotations: { description: 'Create directory' },
596
- returnType: rillTypeToTypeValue({ type: 'bool' }),
597
- },
598
- copy: {
599
- params: [
600
- {
601
- name: 'mount',
602
- type: { type: 'string' },
603
- defaultValue: undefined,
604
- annotations: { description: 'Mount name' },
605
- },
606
- {
607
- name: 'src',
608
- type: { type: 'string' },
609
- defaultValue: undefined,
610
- annotations: { description: 'Source file path' },
611
- },
612
- {
613
- name: 'dest',
614
- type: { type: 'string' },
615
- defaultValue: undefined,
616
- annotations: { description: 'Destination file path' },
617
- },
618
- ],
619
- fn: copy,
620
- annotations: { description: 'Copy file within mount' },
621
- returnType: rillTypeToTypeValue({ type: 'bool' }),
622
- },
623
- move: {
624
- params: [
625
- {
626
- name: 'mount',
627
- type: { type: 'string' },
628
- defaultValue: undefined,
629
- annotations: { description: 'Mount name' },
630
- },
631
- {
632
- name: 'src',
633
- type: { type: 'string' },
634
- defaultValue: undefined,
635
- annotations: { description: 'Source file path' },
636
- },
637
- {
638
- name: 'dest',
639
- type: { type: 'string' },
640
- defaultValue: undefined,
641
- annotations: { description: 'Destination file path' },
642
- },
643
- ],
644
- fn: move,
645
- annotations: { description: 'Move file within mount' },
646
- returnType: rillTypeToTypeValue({ type: 'bool' }),
647
- },
648
- mounts: {
649
- params: [],
650
- fn: mountsList,
651
- annotations: { description: 'List configured mounts' },
652
- returnType: rillTypeToTypeValue({ type: 'list' }),
416
+ value: {
417
+ read: toCallable({
418
+ params: [
419
+ {
420
+ name: 'mount',
421
+ type: { kind: 'string' },
422
+ defaultValue: undefined,
423
+ annotations: { description: 'Mount name' },
424
+ },
425
+ {
426
+ name: 'path',
427
+ type: { kind: 'string' },
428
+ defaultValue: undefined,
429
+ annotations: { description: 'File path relative to mount' },
430
+ },
431
+ ],
432
+ fn: read,
433
+ annotations: { description: 'Read file contents' },
434
+ returnType: rillTypeToTypeValue({ kind: 'string' }),
435
+ }),
436
+ write: toCallable({
437
+ params: [
438
+ {
439
+ name: 'mount',
440
+ type: { kind: 'string' },
441
+ defaultValue: undefined,
442
+ annotations: { description: 'Mount name' },
443
+ },
444
+ {
445
+ name: 'path',
446
+ type: { kind: 'string' },
447
+ defaultValue: undefined,
448
+ annotations: { description: 'File path relative to mount' },
449
+ },
450
+ {
451
+ name: 'content',
452
+ type: { kind: 'string' },
453
+ defaultValue: undefined,
454
+ annotations: { description: 'Content to write' },
455
+ },
456
+ ],
457
+ fn: write,
458
+ annotations: { description: 'Write file, replacing if exists' },
459
+ returnType: rillTypeToTypeValue({ kind: 'string' }),
460
+ }),
461
+ append: toCallable({
462
+ params: [
463
+ {
464
+ name: 'mount',
465
+ type: { kind: 'string' },
466
+ defaultValue: undefined,
467
+ annotations: { description: 'Mount name' },
468
+ },
469
+ {
470
+ name: 'path',
471
+ type: { kind: 'string' },
472
+ defaultValue: undefined,
473
+ annotations: { description: 'File path relative to mount' },
474
+ },
475
+ {
476
+ name: 'content',
477
+ type: { kind: 'string' },
478
+ defaultValue: undefined,
479
+ annotations: { description: 'Content to append' },
480
+ },
481
+ ],
482
+ fn: append,
483
+ annotations: { description: 'Append content to file' },
484
+ returnType: rillTypeToTypeValue({ kind: 'string' }),
485
+ }),
486
+ list: toCallable({
487
+ params: [
488
+ {
489
+ name: 'mount',
490
+ type: { kind: 'string' },
491
+ defaultValue: undefined,
492
+ annotations: { description: 'Mount name' },
493
+ },
494
+ {
495
+ name: 'path',
496
+ type: { kind: 'string' },
497
+ defaultValue: '',
498
+ annotations: { description: 'Directory path relative to mount' },
499
+ },
500
+ ],
501
+ fn: list,
502
+ annotations: { description: 'List directory contents' },
503
+ returnType: rillTypeToTypeValue({ kind: 'list' }),
504
+ }),
505
+ find: toCallable({
506
+ params: [
507
+ {
508
+ name: 'mount',
509
+ type: { kind: 'string' },
510
+ defaultValue: undefined,
511
+ annotations: { description: 'Mount name' },
512
+ },
513
+ {
514
+ name: 'pattern',
515
+ type: { kind: 'string' },
516
+ defaultValue: '*',
517
+ annotations: { description: 'Glob pattern for filtering' },
518
+ },
519
+ ],
520
+ fn: find,
521
+ annotations: { description: 'Recursive file search' },
522
+ returnType: rillTypeToTypeValue({ kind: 'list' }),
523
+ }),
524
+ exists: toCallable({
525
+ params: [
526
+ {
527
+ name: 'mount',
528
+ type: { kind: 'string' },
529
+ defaultValue: undefined,
530
+ annotations: { description: 'Mount name' },
531
+ },
532
+ {
533
+ name: 'path',
534
+ type: { kind: 'string' },
535
+ defaultValue: undefined,
536
+ annotations: { description: 'File path relative to mount' },
537
+ },
538
+ ],
539
+ fn: exists,
540
+ annotations: { description: 'Check file existence' },
541
+ returnType: rillTypeToTypeValue({ kind: 'bool' }),
542
+ }),
543
+ remove: toCallable({
544
+ params: [
545
+ {
546
+ name: 'mount',
547
+ type: { kind: 'string' },
548
+ defaultValue: undefined,
549
+ annotations: { description: 'Mount name' },
550
+ },
551
+ {
552
+ name: 'path',
553
+ type: { kind: 'string' },
554
+ defaultValue: undefined,
555
+ annotations: { description: 'File path relative to mount' },
556
+ },
557
+ ],
558
+ fn: remove,
559
+ annotations: { description: 'Delete file' },
560
+ returnType: rillTypeToTypeValue({ kind: 'bool' }),
561
+ }),
562
+ stat: toCallable({
563
+ params: [
564
+ {
565
+ name: 'mount',
566
+ type: { kind: 'string' },
567
+ defaultValue: undefined,
568
+ annotations: { description: 'Mount name' },
569
+ },
570
+ {
571
+ name: 'path',
572
+ type: { kind: 'string' },
573
+ defaultValue: undefined,
574
+ annotations: { description: 'File path relative to mount' },
575
+ },
576
+ ],
577
+ fn: stat,
578
+ annotations: { description: 'Get file metadata' },
579
+ returnType: rillTypeToTypeValue({ kind: 'dict' }),
580
+ }),
581
+ mkdir: toCallable({
582
+ params: [
583
+ {
584
+ name: 'mount',
585
+ type: { kind: 'string' },
586
+ defaultValue: undefined,
587
+ annotations: { description: 'Mount name' },
588
+ },
589
+ {
590
+ name: 'path',
591
+ type: { kind: 'string' },
592
+ defaultValue: undefined,
593
+ annotations: { description: 'Directory path relative to mount' },
594
+ },
595
+ ],
596
+ fn: mkdir,
597
+ annotations: { description: 'Create directory' },
598
+ returnType: rillTypeToTypeValue({ kind: 'bool' }),
599
+ }),
600
+ copy: toCallable({
601
+ params: [
602
+ {
603
+ name: 'mount',
604
+ type: { kind: 'string' },
605
+ defaultValue: undefined,
606
+ annotations: { description: 'Mount name' },
607
+ },
608
+ {
609
+ name: 'src',
610
+ type: { kind: 'string' },
611
+ defaultValue: undefined,
612
+ annotations: { description: 'Source file path' },
613
+ },
614
+ {
615
+ name: 'dest',
616
+ type: { kind: 'string' },
617
+ defaultValue: undefined,
618
+ annotations: { description: 'Destination file path' },
619
+ },
620
+ ],
621
+ fn: copy,
622
+ annotations: { description: 'Copy file within mount' },
623
+ returnType: rillTypeToTypeValue({ kind: 'bool' }),
624
+ }),
625
+ move: toCallable({
626
+ params: [
627
+ {
628
+ name: 'mount',
629
+ type: { kind: 'string' },
630
+ defaultValue: undefined,
631
+ annotations: { description: 'Mount name' },
632
+ },
633
+ {
634
+ name: 'src',
635
+ type: { kind: 'string' },
636
+ defaultValue: undefined,
637
+ annotations: { description: 'Source file path' },
638
+ },
639
+ {
640
+ name: 'dest',
641
+ type: { kind: 'string' },
642
+ defaultValue: undefined,
643
+ annotations: { description: 'Destination file path' },
644
+ },
645
+ ],
646
+ fn: move,
647
+ annotations: { description: 'Move file within mount' },
648
+ returnType: rillTypeToTypeValue({ kind: 'bool' }),
649
+ }),
650
+ mounts: toCallable({
651
+ params: [],
652
+ fn: mountsList,
653
+ annotations: { description: 'List configured mounts' },
654
+ returnType: rillTypeToTypeValue({ kind: 'list' }),
655
+ }),
653
656
  },
654
657
  };
655
658
  }
@@ -4,7 +4,7 @@
4
4
  * Provides key-value store operations with JSON persistence and schema validation.
5
5
  * Supports both open mode (any key/value) and declared mode (schema-defined keys only).
6
6
  */
7
- import type { ExtensionResult, ExtensionConfigSchema, ExtensionManifest } from '../../runtime/ext/extensions.js';
7
+ import type { ExtensionFactoryResult, ExtensionConfigSchema, ExtensionManifest } from '../../runtime/ext/extensions.js';
8
8
  import { type SchemaEntry } from './store.js';
9
9
  /** Configuration for a single KV mount */
10
10
  export interface KvMountConfig {
@@ -51,7 +51,7 @@ export declare const configSchema: ExtensionConfigSchema;
51
51
  * Returns 11 functions: get, get_or, set, merge, delete, keys, has, clear, getAll, schema, mounts.
52
52
  *
53
53
  * @param config - Store configuration (mount-based or single-store)
54
- * @returns ExtensionResult with 11 KV functions and dispose handler
54
+ * @returns ExtensionFactoryResult with 11 KV functions and dispose handler
55
55
  * @throws RuntimeError if store file is corrupt (EC-25)
56
56
  *
57
57
  * @example
@@ -78,5 +78,5 @@ export declare const configSchema: ExtensionConfigSchema;
78
78
  * });
79
79
  * ```
80
80
  */
81
- export declare function createKvExtension(config: KvConfig): ExtensionResult;
81
+ export declare function createKvExtension(config: KvConfig): ExtensionFactoryResult;
82
82
  export declare const extensionManifest: ExtensionManifest;