@rcrsr/rill 0.15.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.
- package/README.md +37 -21
- package/dist/ast-nodes.d.ts +2 -13
- package/dist/ast-nodes.js +0 -1
- package/dist/ast-unions.d.ts +0 -1
- package/dist/ast-unions.js +0 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -1
- package/dist/error-classes.d.ts +0 -1
- package/dist/error-classes.js +0 -1
- package/dist/error-formatter.d.ts +0 -1
- package/dist/error-formatter.js +0 -1
- package/dist/error-registry.d.ts +0 -1
- package/dist/error-registry.js +32 -1
- package/dist/ext/crypto/index.d.ts +3 -4
- package/dist/ext/crypto/index.js +66 -64
- package/dist/ext/exec/index.d.ts +3 -4
- package/dist/ext/exec/index.js +17 -12
- package/dist/ext/exec/runner.d.ts +0 -1
- package/dist/ext/exec/runner.js +0 -1
- package/dist/ext/fetch/index.d.ts +3 -4
- package/dist/ext/fetch/index.js +23 -49
- package/dist/ext/fetch/request.d.ts +0 -1
- package/dist/ext/fetch/request.js +0 -1
- package/dist/ext/fs/index.d.ts +3 -4
- package/dist/ext/fs/index.js +268 -266
- package/dist/ext/fs/sandbox.d.ts +0 -1
- package/dist/ext/fs/sandbox.js +0 -1
- package/dist/ext/kv/index.d.ts +3 -4
- package/dist/ext/kv/index.js +216 -215
- package/dist/ext/kv/store.d.ts +0 -1
- package/dist/ext/kv/store.js +2 -2
- package/dist/ext-parse-bridge.d.ts +10 -0
- package/dist/ext-parse-bridge.js +10 -0
- package/dist/generated/introspection-data.d.ts +1 -2
- package/dist/generated/introspection-data.js +385 -297
- package/dist/generated/version-data.d.ts +1 -2
- package/dist/generated/version-data.js +2 -3
- package/dist/highlight-map.d.ts +0 -1
- package/dist/highlight-map.js +0 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.js +14 -6
- package/dist/lexer/errors.d.ts +0 -1
- package/dist/lexer/errors.js +0 -1
- package/dist/lexer/helpers.d.ts +0 -1
- package/dist/lexer/helpers.js +0 -1
- package/dist/lexer/index.d.ts +0 -1
- package/dist/lexer/index.js +0 -1
- package/dist/lexer/operators.d.ts +0 -1
- package/dist/lexer/operators.js +0 -1
- package/dist/lexer/readers.d.ts +0 -1
- package/dist/lexer/readers.js +0 -1
- package/dist/lexer/state.d.ts +0 -1
- package/dist/lexer/state.js +0 -1
- package/dist/lexer/tokenizer.d.ts +0 -1
- package/dist/lexer/tokenizer.js +0 -1
- package/dist/parser/helpers.d.ts +0 -1
- package/dist/parser/helpers.js +0 -1
- package/dist/parser/index.d.ts +0 -1
- package/dist/parser/index.js +0 -1
- package/dist/parser/parser-collect.d.ts +0 -1
- package/dist/parser/parser-collect.js +0 -1
- package/dist/parser/parser-control.d.ts +0 -1
- package/dist/parser/parser-control.js +0 -1
- package/dist/parser/parser-expr.d.ts +0 -1
- package/dist/parser/parser-expr.js +0 -1
- package/dist/parser/parser-extract.d.ts +0 -1
- package/dist/parser/parser-extract.js +0 -1
- package/dist/parser/parser-functions.d.ts +0 -1
- package/dist/parser/parser-functions.js +0 -1
- package/dist/parser/parser-literals.d.ts +0 -1
- package/dist/parser/parser-literals.js +4 -2
- package/dist/parser/parser-script.d.ts +0 -1
- package/dist/parser/parser-script.js +0 -1
- package/dist/parser/parser-shape.d.ts +2 -3
- package/dist/parser/parser-shape.js +8 -52
- package/dist/parser/parser-types.d.ts +28 -2
- package/dist/parser/parser-types.js +76 -13
- package/dist/parser/parser-use.d.ts +0 -1
- package/dist/parser/parser-use.js +7 -2
- package/dist/parser/parser-variables.d.ts +0 -1
- package/dist/parser/parser-variables.js +0 -1
- package/dist/parser/parser.d.ts +0 -1
- package/dist/parser/parser.js +0 -1
- package/dist/parser/state.d.ts +0 -1
- package/dist/parser/state.js +0 -1
- package/dist/runtime/core/callable.d.ts +59 -20
- package/dist/runtime/core/callable.js +188 -39
- package/dist/runtime/core/context.d.ts +0 -12
- package/dist/runtime/core/context.js +77 -77
- package/dist/runtime/core/equals.d.ts +0 -1
- package/dist/runtime/core/equals.js +35 -3
- package/dist/runtime/core/eval/base.d.ts +0 -1
- package/dist/runtime/core/eval/base.js +0 -1
- package/dist/runtime/core/eval/evaluator.d.ts +0 -1
- package/dist/runtime/core/eval/evaluator.js +0 -1
- package/dist/runtime/core/eval/index.d.ts +2 -3
- package/dist/runtime/core/eval/index.js +11 -1
- package/dist/runtime/core/eval/mixins/annotations.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/annotations.js +0 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/closures.js +92 -70
- package/dist/runtime/core/eval/mixins/collections.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/collections.js +9 -4
- package/dist/runtime/core/eval/mixins/control-flow.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.js +0 -1
- package/dist/runtime/core/eval/mixins/conversion.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/conversion.js +196 -188
- package/dist/runtime/core/eval/mixins/core.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/core.js +2 -3
- package/dist/runtime/core/eval/mixins/expressions.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/expressions.js +35 -28
- package/dist/runtime/core/eval/mixins/extraction.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/extraction.js +8 -9
- package/dist/runtime/core/eval/mixins/list-dispatch.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.js +0 -1
- package/dist/runtime/core/eval/mixins/literals.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/literals.js +6 -10
- package/dist/runtime/core/eval/mixins/types.d.ts +2 -1
- package/dist/runtime/core/eval/mixins/types.js +231 -261
- package/dist/runtime/core/eval/mixins/use.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/use.js +0 -1
- package/dist/runtime/core/eval/mixins/variables.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/variables.js +16 -15
- package/dist/runtime/core/eval/types.d.ts +0 -1
- package/dist/runtime/core/eval/types.js +0 -1
- package/dist/runtime/core/execute.d.ts +0 -1
- package/dist/runtime/core/execute.js +0 -1
- package/dist/runtime/core/field-descriptor.d.ts +4 -5
- package/dist/runtime/core/field-descriptor.js +2 -2
- package/dist/runtime/core/introspection.d.ts +0 -1
- package/dist/runtime/core/introspection.js +6 -7
- package/dist/runtime/core/markers.d.ts +12 -0
- package/dist/runtime/core/markers.js +7 -0
- package/dist/runtime/core/resolvers.d.ts +0 -1
- package/dist/runtime/core/resolvers.js +0 -1
- package/dist/runtime/core/signals.d.ts +0 -1
- package/dist/runtime/core/signals.js +0 -1
- package/dist/runtime/core/type-registrations.d.ts +136 -0
- package/dist/runtime/core/type-registrations.js +749 -0
- package/dist/runtime/core/type-structures.d.ts +128 -0
- package/dist/runtime/core/type-structures.js +12 -0
- package/dist/runtime/core/types.d.ts +15 -4
- package/dist/runtime/core/types.js +0 -1
- package/dist/runtime/core/values.d.ts +88 -146
- package/dist/runtime/core/values.js +466 -470
- package/dist/runtime/ext/builtins.d.ts +0 -1
- package/dist/runtime/ext/builtins.js +125 -80
- package/dist/runtime/ext/extensions.d.ts +30 -125
- package/dist/runtime/ext/extensions.js +0 -94
- package/dist/runtime/ext/test-context.d.ts +28 -0
- package/dist/runtime/ext/test-context.js +154 -0
- package/dist/runtime/index.d.ts +22 -9
- package/dist/runtime/index.js +18 -5
- package/dist/signature-parser.d.ts +2 -3
- package/dist/signature-parser.js +19 -17
- package/dist/source-location.d.ts +0 -1
- package/dist/source-location.js +0 -1
- package/dist/token-types.d.ts +0 -1
- package/dist/token-types.js +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -1
- package/dist/value-types.d.ts +15 -12
- package/dist/value-types.js +0 -1
- package/package.json +2 -1
- package/dist/ast-nodes.d.ts.map +0 -1
- package/dist/ast-nodes.js.map +0 -1
- package/dist/ast-unions.d.ts.map +0 -1
- package/dist/ast-unions.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/error-classes.d.ts.map +0 -1
- package/dist/error-classes.js.map +0 -1
- package/dist/error-formatter.d.ts.map +0 -1
- package/dist/error-formatter.js.map +0 -1
- package/dist/error-registry.d.ts.map +0 -1
- package/dist/error-registry.js.map +0 -1
- package/dist/ext/crypto/index.d.ts.map +0 -1
- package/dist/ext/crypto/index.js.map +0 -1
- package/dist/ext/exec/index.d.ts.map +0 -1
- package/dist/ext/exec/index.js.map +0 -1
- package/dist/ext/exec/runner.d.ts.map +0 -1
- package/dist/ext/exec/runner.js.map +0 -1
- package/dist/ext/fetch/index.d.ts.map +0 -1
- package/dist/ext/fetch/index.js.map +0 -1
- package/dist/ext/fetch/request.d.ts.map +0 -1
- package/dist/ext/fetch/request.js.map +0 -1
- package/dist/ext/fs/index.d.ts.map +0 -1
- package/dist/ext/fs/index.js.map +0 -1
- package/dist/ext/fs/sandbox.d.ts.map +0 -1
- package/dist/ext/fs/sandbox.js.map +0 -1
- package/dist/ext/kv/index.d.ts.map +0 -1
- package/dist/ext/kv/index.js.map +0 -1
- package/dist/ext/kv/store.d.ts.map +0 -1
- package/dist/ext/kv/store.js.map +0 -1
- package/dist/generated/introspection-data.d.ts.map +0 -1
- package/dist/generated/introspection-data.js.map +0 -1
- package/dist/generated/version-data.d.ts.map +0 -1
- package/dist/generated/version-data.js.map +0 -1
- package/dist/highlight-map.d.ts.map +0 -1
- package/dist/highlight-map.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lexer/errors.d.ts.map +0 -1
- package/dist/lexer/errors.js.map +0 -1
- package/dist/lexer/helpers.d.ts.map +0 -1
- package/dist/lexer/helpers.js.map +0 -1
- package/dist/lexer/index.d.ts.map +0 -1
- package/dist/lexer/index.js.map +0 -1
- package/dist/lexer/operators.d.ts.map +0 -1
- package/dist/lexer/operators.js.map +0 -1
- package/dist/lexer/readers.d.ts.map +0 -1
- package/dist/lexer/readers.js.map +0 -1
- package/dist/lexer/state.d.ts.map +0 -1
- package/dist/lexer/state.js.map +0 -1
- package/dist/lexer/tokenizer.d.ts.map +0 -1
- package/dist/lexer/tokenizer.js.map +0 -1
- package/dist/parser/helpers.d.ts.map +0 -1
- package/dist/parser/helpers.js.map +0 -1
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/parser-collect.d.ts.map +0 -1
- package/dist/parser/parser-collect.js.map +0 -1
- package/dist/parser/parser-control.d.ts.map +0 -1
- package/dist/parser/parser-control.js.map +0 -1
- package/dist/parser/parser-expr.d.ts.map +0 -1
- package/dist/parser/parser-expr.js.map +0 -1
- package/dist/parser/parser-extract.d.ts.map +0 -1
- package/dist/parser/parser-extract.js.map +0 -1
- package/dist/parser/parser-functions.d.ts.map +0 -1
- package/dist/parser/parser-functions.js.map +0 -1
- package/dist/parser/parser-literals.d.ts.map +0 -1
- package/dist/parser/parser-literals.js.map +0 -1
- package/dist/parser/parser-script.d.ts.map +0 -1
- package/dist/parser/parser-script.js.map +0 -1
- package/dist/parser/parser-shape.d.ts.map +0 -1
- package/dist/parser/parser-shape.js.map +0 -1
- package/dist/parser/parser-types.d.ts.map +0 -1
- package/dist/parser/parser-types.js.map +0 -1
- package/dist/parser/parser-use.d.ts.map +0 -1
- package/dist/parser/parser-use.js.map +0 -1
- package/dist/parser/parser-variables.d.ts.map +0 -1
- package/dist/parser/parser-variables.js.map +0 -1
- package/dist/parser/parser.d.ts.map +0 -1
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/state.d.ts.map +0 -1
- package/dist/parser/state.js.map +0 -1
- package/dist/runtime/core/callable.d.ts.map +0 -1
- package/dist/runtime/core/callable.js.map +0 -1
- package/dist/runtime/core/context.d.ts.map +0 -1
- package/dist/runtime/core/context.js.map +0 -1
- package/dist/runtime/core/equals.d.ts.map +0 -1
- package/dist/runtime/core/equals.js.map +0 -1
- package/dist/runtime/core/eval/base.d.ts.map +0 -1
- package/dist/runtime/core/eval/base.js.map +0 -1
- package/dist/runtime/core/eval/evaluator.d.ts.map +0 -1
- package/dist/runtime/core/eval/evaluator.js.map +0 -1
- package/dist/runtime/core/eval/index.d.ts.map +0 -1
- package/dist/runtime/core/eval/index.js.map +0 -1
- package/dist/runtime/core/eval/mixins/annotations.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/annotations.js.map +0 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/closures.js.map +0 -1
- package/dist/runtime/core/eval/mixins/collections.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/collections.js.map +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.js.map +0 -1
- package/dist/runtime/core/eval/mixins/conversion.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/conversion.js.map +0 -1
- package/dist/runtime/core/eval/mixins/core.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/core.js.map +0 -1
- package/dist/runtime/core/eval/mixins/expressions.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/expressions.js.map +0 -1
- package/dist/runtime/core/eval/mixins/extraction.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/extraction.js.map +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.js.map +0 -1
- package/dist/runtime/core/eval/mixins/literals.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/literals.js.map +0 -1
- package/dist/runtime/core/eval/mixins/types.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/types.js.map +0 -1
- package/dist/runtime/core/eval/mixins/use.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/use.js.map +0 -1
- package/dist/runtime/core/eval/mixins/variables.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/variables.js.map +0 -1
- package/dist/runtime/core/eval/types.d.ts.map +0 -1
- package/dist/runtime/core/eval/types.js.map +0 -1
- package/dist/runtime/core/execute.d.ts.map +0 -1
- package/dist/runtime/core/execute.js.map +0 -1
- package/dist/runtime/core/field-descriptor.d.ts.map +0 -1
- package/dist/runtime/core/field-descriptor.js.map +0 -1
- package/dist/runtime/core/introspection.d.ts.map +0 -1
- package/dist/runtime/core/introspection.js.map +0 -1
- package/dist/runtime/core/resolvers.d.ts.map +0 -1
- package/dist/runtime/core/resolvers.js.map +0 -1
- package/dist/runtime/core/signals.d.ts.map +0 -1
- package/dist/runtime/core/signals.js.map +0 -1
- package/dist/runtime/core/types.d.ts.map +0 -1
- package/dist/runtime/core/types.js.map +0 -1
- package/dist/runtime/core/values.d.ts.map +0 -1
- package/dist/runtime/core/values.js.map +0 -1
- package/dist/runtime/ext/builtins.d.ts.map +0 -1
- package/dist/runtime/ext/builtins.js.map +0 -1
- package/dist/runtime/ext/extensions.d.ts.map +0 -1
- package/dist/runtime/ext/extensions.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/signature-parser.d.ts.map +0 -1
- package/dist/signature-parser.js.map +0 -1
- package/dist/source-location.d.ts.map +0 -1
- package/dist/source-location.js.map +0 -1
- package/dist/token-types.d.ts.map +0 -1
- package/dist/token-types.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/value-types.d.ts.map +0 -1
- package/dist/value-types.js.map +0 -1
package/dist/ext/kv/index.d.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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,6 +78,5 @@ export declare const configSchema: ExtensionConfigSchema;
|
|
|
78
78
|
* });
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
export declare function createKvExtension(config: KvConfig):
|
|
81
|
+
export declare function createKvExtension(config: KvConfig): ExtensionFactoryResult;
|
|
82
82
|
export declare const extensionManifest: ExtensionManifest;
|
|
83
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/ext/kv/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Supports both open mode (any key/value) and declared mode (schema-defined keys only).
|
|
6
6
|
*/
|
|
7
7
|
import { RuntimeError } from '../../error-classes.js';
|
|
8
|
+
import { toCallable } from '../../runtime/core/callable.js';
|
|
8
9
|
import { isDict } from '../../runtime/core/callable.js';
|
|
9
10
|
import { createStore } from './store.js';
|
|
10
11
|
import { rillTypeToTypeValue, } from '../../runtime/core/values.js';
|
|
@@ -22,7 +23,7 @@ export const configSchema = {
|
|
|
22
23
|
* Returns 11 functions: get, get_or, set, merge, delete, keys, has, clear, getAll, schema, mounts.
|
|
23
24
|
*
|
|
24
25
|
* @param config - Store configuration (mount-based or single-store)
|
|
25
|
-
* @returns
|
|
26
|
+
* @returns ExtensionFactoryResult with 11 KV functions and dispose handler
|
|
26
27
|
* @throws RuntimeError if store file is corrupt (EC-25)
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
@@ -112,8 +113,8 @@ export function createKvExtension(config) {
|
|
|
112
113
|
* Returns empty string for missing keys in open mode.
|
|
113
114
|
*/
|
|
114
115
|
const get = async (args) => {
|
|
115
|
-
const mountName = args[
|
|
116
|
-
const key = args[
|
|
116
|
+
const mountName = args['mount'];
|
|
117
|
+
const key = args['key'];
|
|
117
118
|
const store = await getStore(mountName);
|
|
118
119
|
const value = store.get(key);
|
|
119
120
|
// In rill, functions cannot return undefined - return empty string for missing keys in open mode
|
|
@@ -125,9 +126,9 @@ export function createKvExtension(config) {
|
|
|
125
126
|
* Never throws for missing keys (unlike get in declared mode).
|
|
126
127
|
*/
|
|
127
128
|
const get_or = async (args) => {
|
|
128
|
-
const mountName = args[
|
|
129
|
-
const key = args[
|
|
130
|
-
const fallback = args[
|
|
129
|
+
const mountName = args['mount'];
|
|
130
|
+
const key = args['key'];
|
|
131
|
+
const fallback = args['fallback'];
|
|
131
132
|
const store = await getStore(mountName);
|
|
132
133
|
// Check if key exists using has() to avoid schema validation errors
|
|
133
134
|
if (store.has(key)) {
|
|
@@ -141,9 +142,9 @@ export function createKvExtension(config) {
|
|
|
141
142
|
* IR-16, EC-20-24
|
|
142
143
|
*/
|
|
143
144
|
const set = async (args) => {
|
|
144
|
-
const mountName = args[
|
|
145
|
-
const key = args[
|
|
146
|
-
const value = args[
|
|
145
|
+
const mountName = args['mount'];
|
|
146
|
+
const key = args['key'];
|
|
147
|
+
const value = args['value'];
|
|
147
148
|
const store = await getStore(mountName);
|
|
148
149
|
await store.set(key, value);
|
|
149
150
|
return true;
|
|
@@ -153,9 +154,9 @@ export function createKvExtension(config) {
|
|
|
153
154
|
* IR-4, EC-5, EC-6
|
|
154
155
|
*/
|
|
155
156
|
const merge = async (args) => {
|
|
156
|
-
const mountName = args[
|
|
157
|
-
const key = args[
|
|
158
|
-
const partial = args[
|
|
157
|
+
const mountName = args['mount'];
|
|
158
|
+
const key = args['key'];
|
|
159
|
+
const partial = args['partial'];
|
|
159
160
|
const store = await getStore(mountName);
|
|
160
161
|
// Get current value
|
|
161
162
|
const currentValue = store.get(key);
|
|
@@ -177,8 +178,8 @@ export function createKvExtension(config) {
|
|
|
177
178
|
* IR-17
|
|
178
179
|
*/
|
|
179
180
|
const deleteKey = async (args) => {
|
|
180
|
-
const mountName = args[
|
|
181
|
-
const key = args[
|
|
181
|
+
const mountName = args['mount'];
|
|
182
|
+
const key = args['key'];
|
|
182
183
|
const store = await getStore(mountName);
|
|
183
184
|
return store.delete(key);
|
|
184
185
|
};
|
|
@@ -187,7 +188,7 @@ export function createKvExtension(config) {
|
|
|
187
188
|
* IR-6
|
|
188
189
|
*/
|
|
189
190
|
const keys = async (args) => {
|
|
190
|
-
const mountName = args[
|
|
191
|
+
const mountName = args['mount'];
|
|
191
192
|
const store = await getStore(mountName);
|
|
192
193
|
return store.keys();
|
|
193
194
|
};
|
|
@@ -196,8 +197,8 @@ export function createKvExtension(config) {
|
|
|
196
197
|
* IR-7
|
|
197
198
|
*/
|
|
198
199
|
const has = async (args) => {
|
|
199
|
-
const mountName = args[
|
|
200
|
-
const key = args[
|
|
200
|
+
const mountName = args['mount'];
|
|
201
|
+
const key = args['key'];
|
|
201
202
|
const store = await getStore(mountName);
|
|
202
203
|
return store.has(key);
|
|
203
204
|
};
|
|
@@ -206,7 +207,7 @@ export function createKvExtension(config) {
|
|
|
206
207
|
* IR-8
|
|
207
208
|
*/
|
|
208
209
|
const clear = async (args) => {
|
|
209
|
-
const mountName = args[
|
|
210
|
+
const mountName = args['mount'];
|
|
210
211
|
const store = await getStore(mountName);
|
|
211
212
|
store.clear();
|
|
212
213
|
return true;
|
|
@@ -216,7 +217,7 @@ export function createKvExtension(config) {
|
|
|
216
217
|
* IR-9
|
|
217
218
|
*/
|
|
218
219
|
const getAll = async (args) => {
|
|
219
|
-
const mountName = args[
|
|
220
|
+
const mountName = args['mount'];
|
|
220
221
|
const store = await getStore(mountName);
|
|
221
222
|
return store.getAll();
|
|
222
223
|
};
|
|
@@ -225,7 +226,7 @@ export function createKvExtension(config) {
|
|
|
225
226
|
* IR-10
|
|
226
227
|
*/
|
|
227
228
|
const schema = async (args) => {
|
|
228
|
-
const mountName = args[
|
|
229
|
+
const mountName = args['mount'];
|
|
229
230
|
const mountConfig = mounts[mountName];
|
|
230
231
|
if (!mountConfig) {
|
|
231
232
|
throw new RuntimeError('RILL-R004', `Mount '${mountName}' not found`, undefined, { mountName, availableMounts: Object.keys(mounts) });
|
|
@@ -279,204 +280,205 @@ export function createKvExtension(config) {
|
|
|
279
280
|
// ============================================================
|
|
280
281
|
// EXTENSION RESULT
|
|
281
282
|
// ============================================================
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
283
|
+
return {
|
|
284
|
+
value: {
|
|
285
|
+
get: toCallable({
|
|
286
|
+
params: [
|
|
287
|
+
{
|
|
288
|
+
name: 'mount',
|
|
289
|
+
type: { kind: 'string' },
|
|
290
|
+
defaultValue: undefined,
|
|
291
|
+
annotations: { description: 'Mount name' },
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'key',
|
|
295
|
+
type: { kind: 'string' },
|
|
296
|
+
defaultValue: undefined,
|
|
297
|
+
annotations: { description: 'Key to retrieve' },
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
fn: get,
|
|
301
|
+
annotations: { description: 'Get value or schema default' },
|
|
302
|
+
returnType: rillTypeToTypeValue({ kind: 'any' }),
|
|
303
|
+
}),
|
|
304
|
+
get_or: toCallable({
|
|
305
|
+
params: [
|
|
306
|
+
{
|
|
307
|
+
name: 'mount',
|
|
308
|
+
type: { kind: 'string' },
|
|
309
|
+
defaultValue: undefined,
|
|
310
|
+
annotations: { description: 'Mount name' },
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: 'key',
|
|
314
|
+
type: { kind: 'string' },
|
|
315
|
+
defaultValue: undefined,
|
|
316
|
+
annotations: { description: 'Key to retrieve' },
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: 'fallback',
|
|
320
|
+
type: { kind: 'any' },
|
|
321
|
+
defaultValue: undefined,
|
|
322
|
+
annotations: { description: 'Fallback value if key missing' },
|
|
323
|
+
},
|
|
324
|
+
],
|
|
325
|
+
fn: get_or,
|
|
326
|
+
annotations: {
|
|
327
|
+
description: 'Get value or return fallback if key missing',
|
|
290
328
|
},
|
|
291
|
-
{
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
329
|
+
returnType: rillTypeToTypeValue({ kind: 'any' }),
|
|
330
|
+
}),
|
|
331
|
+
set: toCallable({
|
|
332
|
+
params: [
|
|
333
|
+
{
|
|
334
|
+
name: 'mount',
|
|
335
|
+
type: { kind: 'string' },
|
|
336
|
+
defaultValue: undefined,
|
|
337
|
+
annotations: { description: 'Mount name' },
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: 'key',
|
|
341
|
+
type: { kind: 'string' },
|
|
342
|
+
defaultValue: undefined,
|
|
343
|
+
annotations: { description: 'Key to set' },
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: 'value',
|
|
347
|
+
type: { kind: 'any' },
|
|
348
|
+
defaultValue: undefined,
|
|
349
|
+
annotations: { description: 'Value to store' },
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
fn: set,
|
|
353
|
+
annotations: { description: 'Set value with validation' },
|
|
354
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
355
|
+
}),
|
|
356
|
+
merge: toCallable({
|
|
357
|
+
params: [
|
|
358
|
+
{
|
|
359
|
+
name: 'mount',
|
|
360
|
+
type: { kind: 'string' },
|
|
361
|
+
defaultValue: undefined,
|
|
362
|
+
annotations: { description: 'Mount name' },
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: 'key',
|
|
366
|
+
type: { kind: 'string' },
|
|
367
|
+
defaultValue: undefined,
|
|
368
|
+
annotations: { description: 'Key to merge into' },
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
name: 'partial',
|
|
372
|
+
type: { kind: 'dict' },
|
|
373
|
+
defaultValue: undefined,
|
|
374
|
+
annotations: { description: 'Partial dict to merge' },
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
fn: merge,
|
|
378
|
+
annotations: {
|
|
379
|
+
description: 'Merge partial dict into existing dict value',
|
|
296
380
|
},
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
],
|
|
396
|
-
fn: deleteKey,
|
|
397
|
-
annotations: { description: 'Delete key' },
|
|
398
|
-
returnType: rillTypeToTypeValue({ type: 'bool' }),
|
|
399
|
-
},
|
|
400
|
-
keys: {
|
|
401
|
-
params: [
|
|
402
|
-
{
|
|
403
|
-
name: 'mount',
|
|
404
|
-
type: { type: 'string' },
|
|
405
|
-
defaultValue: undefined,
|
|
406
|
-
annotations: { description: 'Mount name' },
|
|
407
|
-
},
|
|
408
|
-
],
|
|
409
|
-
fn: keys,
|
|
410
|
-
annotations: { description: 'Get all keys in mount' },
|
|
411
|
-
returnType: rillTypeToTypeValue({ type: 'list' }),
|
|
412
|
-
},
|
|
413
|
-
has: {
|
|
414
|
-
params: [
|
|
415
|
-
{
|
|
416
|
-
name: 'mount',
|
|
417
|
-
type: { type: 'string' },
|
|
418
|
-
defaultValue: undefined,
|
|
419
|
-
annotations: { description: 'Mount name' },
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
name: 'key',
|
|
423
|
-
type: { type: 'string' },
|
|
424
|
-
defaultValue: undefined,
|
|
425
|
-
annotations: { description: 'Key to check' },
|
|
426
|
-
},
|
|
427
|
-
],
|
|
428
|
-
fn: has,
|
|
429
|
-
annotations: { description: 'Check key existence' },
|
|
430
|
-
returnType: rillTypeToTypeValue({ type: 'bool' }),
|
|
431
|
-
},
|
|
432
|
-
clear: {
|
|
433
|
-
params: [
|
|
434
|
-
{
|
|
435
|
-
name: 'mount',
|
|
436
|
-
type: { type: 'string' },
|
|
437
|
-
defaultValue: undefined,
|
|
438
|
-
annotations: { description: 'Mount name' },
|
|
439
|
-
},
|
|
440
|
-
],
|
|
441
|
-
fn: clear,
|
|
442
|
-
annotations: { description: 'Clear all keys in mount' },
|
|
443
|
-
returnType: rillTypeToTypeValue({ type: 'bool' }),
|
|
444
|
-
},
|
|
445
|
-
getAll: {
|
|
446
|
-
params: [
|
|
447
|
-
{
|
|
448
|
-
name: 'mount',
|
|
449
|
-
type: { type: 'string' },
|
|
450
|
-
defaultValue: undefined,
|
|
451
|
-
annotations: { description: 'Mount name' },
|
|
452
|
-
},
|
|
453
|
-
],
|
|
454
|
-
fn: getAll,
|
|
455
|
-
annotations: { description: 'Get all entries as dict' },
|
|
456
|
-
returnType: rillTypeToTypeValue({ type: 'dict' }),
|
|
457
|
-
},
|
|
458
|
-
schema: {
|
|
459
|
-
params: [
|
|
460
|
-
{
|
|
461
|
-
name: 'mount',
|
|
462
|
-
type: { type: 'string' },
|
|
463
|
-
defaultValue: undefined,
|
|
464
|
-
annotations: { description: 'Mount name' },
|
|
465
|
-
},
|
|
466
|
-
],
|
|
467
|
-
fn: schema,
|
|
468
|
-
annotations: { description: 'Get schema information' },
|
|
469
|
-
returnType: rillTypeToTypeValue({ type: 'list' }),
|
|
470
|
-
},
|
|
471
|
-
mounts: {
|
|
472
|
-
params: [],
|
|
473
|
-
fn: mountsList,
|
|
474
|
-
annotations: { description: 'Get list of mount metadata' },
|
|
475
|
-
returnType: rillTypeToTypeValue({ type: 'list' }),
|
|
381
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
382
|
+
}),
|
|
383
|
+
delete: toCallable({
|
|
384
|
+
params: [
|
|
385
|
+
{
|
|
386
|
+
name: 'mount',
|
|
387
|
+
type: { kind: 'string' },
|
|
388
|
+
defaultValue: undefined,
|
|
389
|
+
annotations: { description: 'Mount name' },
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: 'key',
|
|
393
|
+
type: { kind: 'string' },
|
|
394
|
+
defaultValue: undefined,
|
|
395
|
+
annotations: { description: 'Key to delete' },
|
|
396
|
+
},
|
|
397
|
+
],
|
|
398
|
+
fn: deleteKey,
|
|
399
|
+
annotations: { description: 'Delete key' },
|
|
400
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
401
|
+
}),
|
|
402
|
+
keys: toCallable({
|
|
403
|
+
params: [
|
|
404
|
+
{
|
|
405
|
+
name: 'mount',
|
|
406
|
+
type: { kind: 'string' },
|
|
407
|
+
defaultValue: undefined,
|
|
408
|
+
annotations: { description: 'Mount name' },
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
fn: keys,
|
|
412
|
+
annotations: { description: 'Get all keys in mount' },
|
|
413
|
+
returnType: rillTypeToTypeValue({ kind: 'list' }),
|
|
414
|
+
}),
|
|
415
|
+
has: toCallable({
|
|
416
|
+
params: [
|
|
417
|
+
{
|
|
418
|
+
name: 'mount',
|
|
419
|
+
type: { kind: 'string' },
|
|
420
|
+
defaultValue: undefined,
|
|
421
|
+
annotations: { description: 'Mount name' },
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: 'key',
|
|
425
|
+
type: { kind: 'string' },
|
|
426
|
+
defaultValue: undefined,
|
|
427
|
+
annotations: { description: 'Key to check' },
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
fn: has,
|
|
431
|
+
annotations: { description: 'Check key existence' },
|
|
432
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
433
|
+
}),
|
|
434
|
+
clear: toCallable({
|
|
435
|
+
params: [
|
|
436
|
+
{
|
|
437
|
+
name: 'mount',
|
|
438
|
+
type: { kind: 'string' },
|
|
439
|
+
defaultValue: undefined,
|
|
440
|
+
annotations: { description: 'Mount name' },
|
|
441
|
+
},
|
|
442
|
+
],
|
|
443
|
+
fn: clear,
|
|
444
|
+
annotations: { description: 'Clear all keys in mount' },
|
|
445
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
446
|
+
}),
|
|
447
|
+
getAll: toCallable({
|
|
448
|
+
params: [
|
|
449
|
+
{
|
|
450
|
+
name: 'mount',
|
|
451
|
+
type: { kind: 'string' },
|
|
452
|
+
defaultValue: undefined,
|
|
453
|
+
annotations: { description: 'Mount name' },
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
fn: getAll,
|
|
457
|
+
annotations: { description: 'Get all entries as dict' },
|
|
458
|
+
returnType: rillTypeToTypeValue({ kind: 'dict' }),
|
|
459
|
+
}),
|
|
460
|
+
schema: toCallable({
|
|
461
|
+
params: [
|
|
462
|
+
{
|
|
463
|
+
name: 'mount',
|
|
464
|
+
type: { kind: 'string' },
|
|
465
|
+
defaultValue: undefined,
|
|
466
|
+
annotations: { description: 'Mount name' },
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
fn: schema,
|
|
470
|
+
annotations: { description: 'Get schema information' },
|
|
471
|
+
returnType: rillTypeToTypeValue({ kind: 'list' }),
|
|
472
|
+
}),
|
|
473
|
+
mounts: toCallable({
|
|
474
|
+
params: [],
|
|
475
|
+
fn: mountsList,
|
|
476
|
+
annotations: { description: 'Get list of mount metadata' },
|
|
477
|
+
returnType: rillTypeToTypeValue({ kind: 'list' }),
|
|
478
|
+
}),
|
|
476
479
|
},
|
|
480
|
+
dispose,
|
|
477
481
|
};
|
|
478
|
-
result.dispose = dispose;
|
|
479
|
-
return result;
|
|
480
482
|
}
|
|
481
483
|
// ============================================================
|
|
482
484
|
// MANIFEST
|
|
@@ -485,4 +487,3 @@ export const extensionManifest = {
|
|
|
485
487
|
factory: createKvExtension,
|
|
486
488
|
configSchema,
|
|
487
489
|
};
|
|
488
|
-
//# sourceMappingURL=index.js.map
|
package/dist/ext/kv/store.d.ts
CHANGED
package/dist/ext/kv/store.js
CHANGED
|
@@ -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 { deserializeValue } from '../../runtime/core/type-registrations.js';
|
|
10
11
|
// ============================================================
|
|
11
12
|
// STORE IMPLEMENTATION
|
|
12
13
|
// ============================================================
|
|
@@ -52,7 +53,7 @@ export async function createStore(config) {
|
|
|
52
53
|
// Load declared keys with defaults, validate existing values
|
|
53
54
|
for (const [key, schemaEntry] of Object.entries(schema)) {
|
|
54
55
|
if (key in parsed) {
|
|
55
|
-
const value = parsed[key];
|
|
56
|
+
const value = deserializeValue(parsed[key], schemaEntry.type);
|
|
56
57
|
validateType(key, value, schemaEntry.type, storePath);
|
|
57
58
|
data.set(key, value);
|
|
58
59
|
}
|
|
@@ -267,4 +268,3 @@ export async function createStore(config) {
|
|
|
267
268
|
flush,
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
|
-
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge for runtime/ext modules that need parse().
|
|
3
|
+
*
|
|
4
|
+
* Import boundary note (§NOD.2.1):
|
|
5
|
+
* - This file lives at src/ level (not in runtime/), so it may import
|
|
6
|
+
* from the parser barrel.
|
|
7
|
+
* - runtime/ext/test-context.ts imports from this file
|
|
8
|
+
* (../../ext-parse-bridge.js), which is NOT in parser/* — boundary preserved.
|
|
9
|
+
*/
|
|
10
|
+
export { parse as parseSource } from './parser/index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge for runtime/ext modules that need parse().
|
|
3
|
+
*
|
|
4
|
+
* Import boundary note (§NOD.2.1):
|
|
5
|
+
* - This file lives at src/ level (not in runtime/), so it may import
|
|
6
|
+
* from the parser barrel.
|
|
7
|
+
* - runtime/ext/test-context.ts imports from this file
|
|
8
|
+
* (../../ext-parse-bridge.js), which is NOT in parser/* — boundary preserved.
|
|
9
|
+
*/
|
|
10
|
+
export { parse as parseSource } from './parser/index.js';
|