@anchorlib/svelte 1.0.0-beta.2 → 1.0.0-beta.21
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/dist/anchor.d.ts +86 -0
- package/dist/anchor.js +68 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/derive.d.ts +17 -0
- package/dist/derive.js +34 -0
- package/dist/fetch.d.ts +62 -0
- package/dist/fetch.js +12 -0
- package/dist/history.d.ts +14 -0
- package/dist/history.js +16 -0
- package/dist/immutable.d.ts +49 -0
- package/dist/immutable.js +14 -0
- package/dist/index.d.ts +12 -304
- package/dist/index.js +12 -206
- package/dist/model.d.ts +41 -0
- package/dist/model.js +20 -0
- package/dist/observable.d.ts +17 -0
- package/dist/observable.js +36 -0
- package/dist/prop.d.ts +21 -0
- package/dist/prop.js +19 -0
- package/dist/reactive.d.ts +6 -0
- package/dist/reactive.js +51 -0
- package/dist/ref.d.ts +52 -0
- package/dist/ref.js +67 -0
- package/dist/storage/index.d.ts +8 -61
- package/dist/storage/index.js +9 -64
- package/dist/storage/kv.d.ts +19 -0
- package/dist/storage/kv.js +26 -0
- package/dist/storage/persistent.d.ts +20 -0
- package/dist/storage/persistent.js +27 -0
- package/dist/storage/session.d.ts +20 -0
- package/dist/storage/session.js +27 -0
- package/dist/storage/table.d.ts +15 -0
- package/dist/storage/table.js +46 -0
- package/dist/storage/types.d.ts +16 -0
- package/dist/storage/types.js +0 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.js +0 -0
- package/package.json +32 -20
- package/readme.md +7 -16
- package/dist/index.js.map +0 -1
- package/dist/storage/index.js.map +0 -1
- package/dist/types-CsfltB4A.d.ts +0 -16
package/dist/anchor.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Immutable, Linkable, LinkableSchema, ModelArray, ModelInput, ModelOutput, StateOptions } from "@anchorlib/core";
|
|
2
|
+
|
|
3
|
+
//#region src/anchor.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use 'mutable()' instead.
|
|
7
|
+
* Creates a reactive state that can be used to manage state with Anchor.
|
|
8
|
+
* This overload is used when no schema is provided, or when using a LinkableSchema with StateOptions.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The type of the initial value
|
|
11
|
+
* @template S - The schema type, extending LinkableSchema
|
|
12
|
+
* @param init - The initial value for the state
|
|
13
|
+
* @param options - Optional state options for the state
|
|
14
|
+
* @returns A reactive state containing the initial value
|
|
15
|
+
*/
|
|
16
|
+
declare function anchorRef<T extends Linkable, S extends LinkableSchema = LinkableSchema>(init: T, options?: StateOptions<S>): T;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use 'mutable()' instead.
|
|
19
|
+
* Creates a reactive state with a defined schema for validation and type inference.
|
|
20
|
+
*
|
|
21
|
+
* @template S - The schema type, extending LinkableSchema
|
|
22
|
+
* @template T - The type of the initial value, must extend ModelInput of the schema
|
|
23
|
+
* @param init - The initial value for the state
|
|
24
|
+
* @param schema - The schema to validate and type the state
|
|
25
|
+
* @param options - Optional state options for the state
|
|
26
|
+
* @returns A reactive state containing the output model based on the schema
|
|
27
|
+
*/
|
|
28
|
+
declare function anchorRef<S extends LinkableSchema, T extends ModelInput<S>>(init: T, schema?: S, options?: StateOptions): ModelOutput<S>;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use 'mutable()' instead.
|
|
31
|
+
* Creates an immutable reactive state with a defined schema.
|
|
32
|
+
*
|
|
33
|
+
* @template S - The schema type, extending LinkableSchema
|
|
34
|
+
* @template T - The type of the initial value, must extend ModelInput of the schema
|
|
35
|
+
* @param init - The initial value for the state
|
|
36
|
+
* @param schema - The schema to validate and type the state
|
|
37
|
+
* @param options - State options with immutable flag set to true
|
|
38
|
+
* @returns A reactive state containing an immutable output model based on the schema
|
|
39
|
+
*/
|
|
40
|
+
declare function anchorRef<S extends LinkableSchema, T extends ModelInput<S>>(init: T, schema?: S, options?: StateOptions & {
|
|
41
|
+
immutable: true;
|
|
42
|
+
}): Immutable<ModelOutput<S>>;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Use 'mutable()' instead.
|
|
45
|
+
* Reactive state alias for anchorRef.
|
|
46
|
+
* @type {{<T, S=LinkableSchema extends LinkableSchema>(init: T, options?: StateOptions<S>): T, <S extends LinkableSchema, T extends ModelInput<S>>(init: T, schema?: S, options?: StateOptions): ModelOutput<S>, <S extends LinkableSchema, T extends ModelInput<S>>(init: T, schema?: S, options?: (StateOptions & {immutable: true})): Immutable<ModelOutput<S>>}}
|
|
47
|
+
*/
|
|
48
|
+
declare const reactiveRef: typeof anchorRef;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Use 'ordered()' instead.
|
|
51
|
+
* Creates a reactive state that maintains a sorted array state based on a comparison function.
|
|
52
|
+
*
|
|
53
|
+
* @template T - The type of elements in the array
|
|
54
|
+
* @template S - The schema type for array elements, extending ModelArray
|
|
55
|
+
* @param init - The initial array value for the state
|
|
56
|
+
* @param compare - A function that defines the sort order of elements
|
|
57
|
+
* @param options - Optional state options for the state
|
|
58
|
+
* @returns A reactive state containing the sorted array
|
|
59
|
+
*/
|
|
60
|
+
declare function orderedRef<T extends unknown[], S extends ModelArray = ModelArray>(init: T, compare: (a: T[number], b: T[number]) => number, options?: StateOptions<S>): T;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Use 'flat()' instead.
|
|
63
|
+
* Creates a reactive state that maintains a flat array state.
|
|
64
|
+
*
|
|
65
|
+
* @template T - The type of elements in the array
|
|
66
|
+
* @template S - The schema type for array elements, extending ModelArray
|
|
67
|
+
* @param init - The initial array value for the state
|
|
68
|
+
* @param options - Optional state options for the state
|
|
69
|
+
* @returns A reactive state containing the flat array
|
|
70
|
+
*/
|
|
71
|
+
declare function flatRef<T extends unknown[], S extends ModelArray = ModelArray>(init: T, options?: StateOptions<S>): T;
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Use 'raw()' instead.
|
|
74
|
+
* Creates a reactive state that mutates the underlying object.
|
|
75
|
+
*
|
|
76
|
+
* Unless you set the global options to `cloned: true`, you don't want to use this.
|
|
77
|
+
*
|
|
78
|
+
* @template T - The type of the initial value
|
|
79
|
+
* @template S - The schema type, extending LinkableSchema
|
|
80
|
+
* @param init - The initial value for the state
|
|
81
|
+
* @param options - Optional state options for the state
|
|
82
|
+
* @returns A reactive state containing the raw value
|
|
83
|
+
*/
|
|
84
|
+
declare function rawRef<T extends Linkable, S extends LinkableSchema = LinkableSchema>(init: T, options?: StateOptions<S>): T;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { anchorRef, flatRef, orderedRef, rawRef, reactiveRef };
|
package/dist/anchor.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { anchor } from "@anchorlib/core";
|
|
2
|
+
|
|
3
|
+
//#region src/anchor.ts
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use 'mutable()' instead.
|
|
6
|
+
* Creates a reactive state for state management with optional schema validation.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type of the initial value
|
|
9
|
+
* @template S - The schema type or options
|
|
10
|
+
* @param init - The initial value for the state
|
|
11
|
+
* @param schemaOptions - Either a schema or state options
|
|
12
|
+
* @param options - Additional state options when schema is provided
|
|
13
|
+
* @returns A reactive state containing the managed state
|
|
14
|
+
*/
|
|
15
|
+
function anchorRef(init, schemaOptions, options) {
|
|
16
|
+
return anchor(init, schemaOptions, options);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use 'mutable()' instead.
|
|
20
|
+
* Reactive state alias for anchorRef.
|
|
21
|
+
* @type {{<T, S=LinkableSchema extends LinkableSchema>(init: T, options?: StateOptions<S>): T, <S extends LinkableSchema, T extends ModelInput<S>>(init: T, schema?: S, options?: StateOptions): ModelOutput<S>, <S extends LinkableSchema, T extends ModelInput<S>>(init: T, schema?: S, options?: (StateOptions & {immutable: true})): Immutable<ModelOutput<S>>}}
|
|
22
|
+
*/
|
|
23
|
+
const reactiveRef = anchorRef;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use 'ordered()' instead.
|
|
26
|
+
* Creates a reactive state that maintains a sorted array state based on a comparison function.
|
|
27
|
+
*
|
|
28
|
+
* @template T - The type of elements in the array
|
|
29
|
+
* @template S - The schema type for array elements, extending ModelArray
|
|
30
|
+
* @param init - The initial array value for the state
|
|
31
|
+
* @param compare - A function that defines the sort order of elements
|
|
32
|
+
* @param options - Optional state options for the state
|
|
33
|
+
* @returns A reactive state containing the sorted array
|
|
34
|
+
*/
|
|
35
|
+
function orderedRef(init, compare, options) {
|
|
36
|
+
return anchor.ordered(init, compare, options);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use 'flat()' instead.
|
|
40
|
+
* Creates a reactive state that maintains a flat array state.
|
|
41
|
+
*
|
|
42
|
+
* @template T - The type of elements in the array
|
|
43
|
+
* @template S - The schema type for array elements, extending ModelArray
|
|
44
|
+
* @param init - The initial array value for the state
|
|
45
|
+
* @param options - Optional state options for the state
|
|
46
|
+
* @returns A reactive state containing the flat array
|
|
47
|
+
*/
|
|
48
|
+
function flatRef(init, options) {
|
|
49
|
+
return anchor.flat(init, options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use 'raw()' instead.
|
|
53
|
+
* Creates a reactive state that mutates the underlying object.
|
|
54
|
+
*
|
|
55
|
+
* Unless you set the global options to `cloned: true`, you don't want to use this.
|
|
56
|
+
*
|
|
57
|
+
* @template T - The type of the initial value
|
|
58
|
+
* @template S - The schema type, extending LinkableSchema
|
|
59
|
+
* @param init - The initial value for the state
|
|
60
|
+
* @param options - Optional state options for the state
|
|
61
|
+
* @returns A reactive state containing the raw value
|
|
62
|
+
*/
|
|
63
|
+
function rawRef(init, options) {
|
|
64
|
+
return anchor.raw(init, options);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { anchorRef, flatRef, orderedRef, rawRef, reactiveRef };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@anchorlib/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@anchorlib/core"
|
package/dist/derive.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ConstantRef } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/derive.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use `derived()` instead.
|
|
7
|
+
* Creates a derived state from a source state with an optional transformation.
|
|
8
|
+
*
|
|
9
|
+
* @template T - The type of the input state
|
|
10
|
+
* @template R - The type of the transformed output
|
|
11
|
+
* @param state - The source state
|
|
12
|
+
* @param derive - A function that transforms the current state value
|
|
13
|
+
* @returns A read-only reference containing the derived state value
|
|
14
|
+
*/
|
|
15
|
+
declare function derivedRef<T, R>(state: T, derive: (current: T) => R): ConstantRef<R>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { derivedRef };
|
package/dist/derive.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { REF_REGISTRY } from "./ref.js";
|
|
2
|
+
import { anchor, subscribe } from "@anchorlib/core";
|
|
3
|
+
import { onDestroy } from "svelte";
|
|
4
|
+
|
|
5
|
+
//#region src/derive.ts
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `derived()` instead.
|
|
8
|
+
* Creates a derived state from a source state with an optional transformation.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The type of the input state
|
|
11
|
+
* @template R - The type of the transformed output
|
|
12
|
+
* @param state - The source state
|
|
13
|
+
* @param derive - A function that transforms the current state value
|
|
14
|
+
* @returns A read-only reference containing the derived state value
|
|
15
|
+
*/
|
|
16
|
+
function derivedRef(state, derive) {
|
|
17
|
+
const valueRef = anchor({}, { recursive: false });
|
|
18
|
+
const stateRef = { get value() {
|
|
19
|
+
return valueRef.value;
|
|
20
|
+
} };
|
|
21
|
+
REF_REGISTRY.set(stateRef, valueRef);
|
|
22
|
+
const unsubscribe = subscribe(state, (current) => {
|
|
23
|
+
valueRef.value = derive(current);
|
|
24
|
+
});
|
|
25
|
+
onDestroy(() => {
|
|
26
|
+
anchor.destroy(valueRef);
|
|
27
|
+
unsubscribe();
|
|
28
|
+
REF_REGISTRY.delete(stateRef);
|
|
29
|
+
});
|
|
30
|
+
return stateRef;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { derivedRef };
|
package/dist/fetch.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FetchOptions, FetchState, StreamOptions } from "@anchorlib/core";
|
|
2
|
+
|
|
3
|
+
//#region src/fetch.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use 'fetchState()' or 'asyncState()' instead.
|
|
7
|
+
* Creates a reactive state that manages the state of a fetch request.
|
|
8
|
+
* This overload is for GET or DELETE requests, which typically do not have a request body.
|
|
9
|
+
*
|
|
10
|
+
* @template R The type of the data expected in the response.
|
|
11
|
+
* @param init The initial value for the fetch state.
|
|
12
|
+
* @param options The options for the fetch request, including the URL and method.
|
|
13
|
+
* @returns A `FetchState` object representing the state of the request.
|
|
14
|
+
*/
|
|
15
|
+
declare function fetchRef<R>(init: R, options: FetchOptions & {
|
|
16
|
+
method: 'GET' | 'DELETE';
|
|
17
|
+
}): FetchState<R>;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use 'fetchState()' or 'asyncState()' instead.
|
|
20
|
+
* Creates a readable Svelte store that manages the state of a fetch request.
|
|
21
|
+
* This overload is for POST, PUT, or PATCH requests, which typically include a request body.
|
|
22
|
+
*
|
|
23
|
+
* @template R The type of the data expected in the response.
|
|
24
|
+
* @template P The type of the request body.
|
|
25
|
+
* @param init The initial value for the fetch state.
|
|
26
|
+
* @param options The options for the fetch request, including the URL, method, and body.
|
|
27
|
+
* @returns A `FetchState` object representing the state of the request.
|
|
28
|
+
*/
|
|
29
|
+
declare function fetchRef<R, P>(init: R, options: FetchOptions & {
|
|
30
|
+
method: 'POST' | 'PUT' | 'PATCH';
|
|
31
|
+
body: P;
|
|
32
|
+
}): FetchState<R>;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use 'streamState()' instead.
|
|
35
|
+
* Creates a reactive state that manages the state of a streaming request.
|
|
36
|
+
* This overload is for GET or DELETE requests, which typically do not have a request body.
|
|
37
|
+
*
|
|
38
|
+
* @template R The type of the data expected in the response.
|
|
39
|
+
* @param init The initial value for the fetch state.
|
|
40
|
+
* @param options The options for the stream request, including the URL and method.
|
|
41
|
+
* @returns A `FetchState` object representing the state of the request.
|
|
42
|
+
*/
|
|
43
|
+
declare function streamRef<R>(init: R, options: StreamOptions<R> & {
|
|
44
|
+
method: 'GET' | 'DELETE';
|
|
45
|
+
}): FetchState<R>;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Use 'streamState()' instead.
|
|
48
|
+
* Creates a reactive state that manages the state of a streaming request.
|
|
49
|
+
* This overload is for POST, PUT, or PATCH requests, which typically include a request body.
|
|
50
|
+
*
|
|
51
|
+
* @template R The type of the data expected in the response.
|
|
52
|
+
* @template P The type of the request body.
|
|
53
|
+
* @param init The initial value for the fetch state.
|
|
54
|
+
* @param options The options for the stream request, including the URL, method, and body.
|
|
55
|
+
* @returns A `FetchState` object representing the state of the request.
|
|
56
|
+
*/
|
|
57
|
+
declare function streamRef<R, P>(init: R, options: StreamOptions<R> & {
|
|
58
|
+
method: 'POST' | 'PUT' | 'PATCH';
|
|
59
|
+
body: P;
|
|
60
|
+
}): FetchState<R>;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { fetchRef, streamRef };
|
package/dist/fetch.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { fetchState, streamState } from "@anchorlib/core";
|
|
2
|
+
|
|
3
|
+
//#region src/fetch.ts
|
|
4
|
+
function fetchRef(init, options) {
|
|
5
|
+
return fetchState(init, options);
|
|
6
|
+
}
|
|
7
|
+
function streamRef(init, options) {
|
|
8
|
+
return streamState(init, options);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { fetchRef, streamRef };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HistoryOptions, HistoryState, State } from "@anchorlib/core";
|
|
2
|
+
|
|
3
|
+
//#region src/history.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use 'history()' instead.
|
|
7
|
+
* Creates a reactive state that reflects the history state of a given Anchor state.
|
|
8
|
+
* @param state The initial Anchor state.
|
|
9
|
+
* @param options Optional history options.
|
|
10
|
+
* @returns A `HistoryState` object representing the state of the history.
|
|
11
|
+
*/
|
|
12
|
+
declare function historyRef<T extends State>(state: T, options?: HistoryOptions): HistoryState;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { historyRef };
|
package/dist/history.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { history } from "@anchorlib/core";
|
|
2
|
+
|
|
3
|
+
//#region src/history.ts
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use 'history()' instead.
|
|
6
|
+
* Creates a reactive state that reflects the history state of a given Anchor state.
|
|
7
|
+
* @param state The initial Anchor state.
|
|
8
|
+
* @param options Optional history options.
|
|
9
|
+
* @returns A `HistoryState` object representing the state of the history.
|
|
10
|
+
*/
|
|
11
|
+
function historyRef(state, options) {
|
|
12
|
+
return history(state, options);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { historyRef };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Immutable, ImmutableOutput, LinkableSchema, ModelInput, Mutable, MutablePart, MutationKey, State, StateBaseOptions, StateOptions } from "@anchorlib/core";
|
|
2
|
+
|
|
3
|
+
//#region src/immutable.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use 'immutable()' instead.
|
|
7
|
+
* Creates an immutable state from a state object.
|
|
8
|
+
*
|
|
9
|
+
* @template T The type of the state object.
|
|
10
|
+
* @template S The type of the linkable schema.
|
|
11
|
+
* @param init The initial state object.
|
|
12
|
+
* @param options Optional state options.
|
|
13
|
+
* @returns An immutable state.
|
|
14
|
+
*/
|
|
15
|
+
declare function immutableRef<T extends State, S extends LinkableSchema = LinkableSchema>(init: T, options?: StateOptions<S>): Immutable<T>;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use 'immutable()' instead.
|
|
18
|
+
* Creates an immutable state from a model input and a schema.
|
|
19
|
+
*
|
|
20
|
+
* @template S The type of the linkable schema.
|
|
21
|
+
* @template T The type of the model input.
|
|
22
|
+
* @param init The initial model input.
|
|
23
|
+
* @param schema The linkable schema.
|
|
24
|
+
* @param options Optional base state options.
|
|
25
|
+
* @returns An immutable state.
|
|
26
|
+
*/
|
|
27
|
+
declare function immutableRef<S extends LinkableSchema, T extends ModelInput<S>>(init: T, schema: S, options?: StateBaseOptions): ImmutableOutput<S>;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use 'writable()' instead.
|
|
30
|
+
* Creates a writable state from a state object.
|
|
31
|
+
*
|
|
32
|
+
* @template T The type of the state object.
|
|
33
|
+
* @param state The initial state object.
|
|
34
|
+
* @returns A mutable state.
|
|
35
|
+
*/
|
|
36
|
+
declare function writableRef<T extends State>(state: T): Mutable<T>;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use 'writable()' instead.
|
|
39
|
+
* Creates a writable state from a state object and a list of contracts.
|
|
40
|
+
*
|
|
41
|
+
* @template T The type of the state object.
|
|
42
|
+
* @template K The type of the mutation keys.
|
|
43
|
+
* @param state The initial state object.
|
|
44
|
+
* @param contracts A list of mutation keys.
|
|
45
|
+
* @returns A mutable part of the state.
|
|
46
|
+
*/
|
|
47
|
+
declare function writableRef<T extends State, K extends MutationKey<T>[]>(state: T, contracts: K): MutablePart<T, K>;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { immutableRef, writableRef };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { anchor } from "@anchorlib/core";
|
|
2
|
+
|
|
3
|
+
//#region src/immutable.ts
|
|
4
|
+
/** Implementation of `immutableRef` overloads. */
|
|
5
|
+
function immutableRef(init, schemaOptions, options) {
|
|
6
|
+
return anchor.immutable(init, schemaOptions, options);
|
|
7
|
+
}
|
|
8
|
+
/** Implementation of `writableRef` overloads. */
|
|
9
|
+
function writableRef(state, contracts) {
|
|
10
|
+
return anchor.writable(state, contracts);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { immutableRef, writableRef };
|