bleam 0.0.10 → 0.0.12
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/ai.cjs +1872 -1182
- package/dist/ai.d.cts +267 -234
- package/dist/ai.d.ts +267 -234
- package/dist/ai.js +1859 -1167
- package/dist/cli.cjs +3 -183
- package/dist/cli.d.cts +3 -47
- package/dist/cli.d.ts +3 -47
- package/dist/cli.js +3 -183
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{files-Ds1wT8C2.js → files-BXVkPrPN.js} +6 -1
- package/dist/{files-Bo7h9fik.cjs → files-DxaQ-Nv0.cjs} +11 -0
- package/dist/files.cjs +1 -1
- package/dist/files.js +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/platform.cjs +1 -13
- package/dist/platform.d.cts +1 -28
- package/dist/platform.d.ts +1 -28
- package/dist/platform.js +1 -10
- package/dist/schema-B5BfdswF.js +226 -0
- package/dist/schema-BnVZOXfu.cjs +286 -0
- package/dist/schema-D5eImHxu.d.cts +125 -0
- package/dist/schema-SSjokbtw.d.ts +125 -0
- package/dist/schema.cjs +10 -2
- package/dist/schema.d.cts +2 -2
- package/dist/schema.d.ts +2 -2
- package/dist/schema.js +2 -2
- package/dist/state-Dh3HLixb.js +874 -0
- package/dist/state-LssDgpff.cjs +973 -0
- package/dist/state.cjs +16 -12
- package/dist/state.d.cts +144 -140
- package/dist/state.d.ts +145 -140
- package/dist/state.js +3 -3
- package/dist/{ui-Bg11tvlc.d.ts → ui-1WepaMS4.d.cts} +1 -1
- package/dist/{ui-Dd7SXdbg.d.cts → ui-D7bRLYee.d.ts} +7 -7
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/window.d.cts +1 -1
- package/dist/window.d.ts +1 -1
- package/package.json +3 -1
- package/templates/foundation-models/app/index.tsx +77 -15
- package/templates/image-generation/app/index.tsx +4 -2
- package/templates/native/ios/Bleam/AI/Flux2/Configuration/ModelRegistry.swift +1 -1
- package/templates/native/ios/Bleam/AI/Flux2/Pipeline/FluxImageRunner.swift +7 -2
- package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextGenerator.swift +46 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextModel.swift +107 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Bonsai/BonsaiTextSnapshotValidator.swift +201 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Core/GenerationTypes.swift +85 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Core/ModelCapabilities.swift +21 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Core/TextKVCache.swift +23 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Core/TokenSampler.swift +79 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3CheckpointLoader.swift +161 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Configuration.swift +119 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3InferenceSession.swift +84 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Layers.swift +197 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen3/Qwen3Model.swift +130 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Checkpoint.swift +102 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Configuration.swift +140 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Model.swift +112 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/Qwen35/Qwen35Session.swift +121 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridCache.swift +42 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridFullAttention.swift +57 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridLayers.swift +58 -0
- package/templates/native/ios/Bleam/AI/TextGeneration/QwenHybrid/QwenHybridLinearAttention.swift +111 -0
- package/templates/native/ios/Bleam/AppDelegate.swift +0 -206
- package/templates/native/ios/Bleam.xcodeproj/project.pbxproj +135 -129
- package/templates/native/ios/GenerationService/BonsaiTextGenerationRunner.swift +103 -0
- package/templates/native/ios/GenerationService/ImageGenerationRunner.swift +19 -7
- package/templates/native/ios/GenerationService/main.swift +174 -48
- package/templates/native/ios/Podfile.lock +173 -173
- package/templates/native/ios/Shared/Generation/GenerationServiceProtocol.swift +3 -0
- package/templates/native/ios/Shared/Generation/GenerationWorkerProtocol.swift +44 -0
- package/templates/native/modules/bleam-runtime/ios/AIModule.swift +239 -341
- package/templates/native/modules/bleam-runtime/ios/GenerationContracts.swift +47 -0
- package/templates/native/modules/bleam-runtime/ios/PlatformModule.swift +0 -191
- package/templates/text-generation/app/index.tsx +124 -0
- package/templates/text-generation/app.config.ts +5 -0
- package/templates/updates/README.md +43 -199
- package/templates/updates/src/index.ts +5 -98
- package/templates/updates/src/schema.ts +18 -173
- package/dist/schema-Bo5Jvqus.js +0 -90
- package/dist/schema-DOOjfXvs.d.ts +0 -58
- package/dist/schema-ENSMX_1t.d.cts +0 -58
- package/dist/schema-rQ13mrpD.cjs +0 -102
- package/dist/state-Bx0VlTlO.cjs +0 -852
- package/dist/state-CAwe-Vw1.js +0 -767
- package/templates/native/ios/PlatformHelper/main.swift +0 -726
- /package/dist/{config-Cms0rvqg.d.ts → config-COcRnn5a.d.cts} +0 -0
- /package/dist/{config-CufOVJV3.d.cts → config-Chi-flpJ.d.ts} +0 -0
package/dist/state.cjs
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
require('./native-runtime-CsXnXkQn.cjs');
|
|
2
2
|
require('./crypto-CT3VZ7lF.cjs');
|
|
3
|
-
const
|
|
4
|
-
require('./
|
|
3
|
+
const require_schema = require('./schema-BnVZOXfu.cjs');
|
|
4
|
+
const require_state = require('./state-LssDgpff.cjs');
|
|
5
5
|
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
6
|
+
exports.CollectionVersionConflictError = require_state.CollectionVersionConflictError;
|
|
7
|
+
exports.array = require_schema.array;
|
|
8
8
|
exports.atom = require_state.atom;
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
9
|
+
exports.atomCollection = require_state.atomCollection;
|
|
10
|
+
exports.boolean = require_schema.boolean;
|
|
11
|
+
exports.literal = require_schema.literal;
|
|
12
|
+
exports.mutateAtom = require_state.mutateAtom;
|
|
13
|
+
exports.number = require_schema.number;
|
|
14
|
+
exports.object = require_schema.object;
|
|
15
|
+
exports.queryAtom = require_state.queryAtom;
|
|
16
|
+
exports.string = require_schema.string;
|
|
17
|
+
exports.transactionAtom = require_state.transactionAtom;
|
|
14
18
|
exports.useAtom = require_state.useAtom;
|
|
19
|
+
exports.useAtomValue = require_state.useAtomValue;
|
|
15
20
|
exports.useField = require_state.useField;
|
|
16
21
|
exports.useList = require_state.useList;
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.useView = require_state.useView;
|
|
22
|
+
exports.useRow = require_state.useRow;
|
|
23
|
+
exports.useSetAtom = require_state.useSetAtom;
|
package/dist/state.d.cts
CHANGED
|
@@ -1,159 +1,163 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as array, C as SchemaOutput, E as SchemaShape, F as number, I as object, P as literal, R as string, _ as ObjectField, b as SchemaInput, c as FieldPath, j as boolean, k as ValueAtFieldPath, s as FieldOutput, w as SchemaPatch } from "./schema-D5eImHxu.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/state/atom.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
declare const atomValue: unique symbol;
|
|
5
|
+
declare const atomWrite: unique symbol;
|
|
6
|
+
interface Atom<Value> {
|
|
7
|
+
readonly [atomValue]: Value;
|
|
8
8
|
}
|
|
9
|
-
interface
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
private value;
|
|
15
|
-
private listeners;
|
|
16
|
-
constructor(value: Value);
|
|
17
|
-
get(): Value;
|
|
18
|
-
set(value: Value): void;
|
|
19
|
-
update(updater: (value: Value) => Value): void;
|
|
20
|
-
subscribe(listener: Listener): () => void;
|
|
9
|
+
interface WritableAtom<Value, Args$1 extends unknown[], Result$1> extends Atom<Value> {
|
|
10
|
+
readonly [atomWrite]: {
|
|
11
|
+
args: Args$1;
|
|
12
|
+
result: Result$1;
|
|
13
|
+
};
|
|
21
14
|
}
|
|
22
|
-
type
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
type SetStateAction<Value> = Value | ((current: Value) => Value);
|
|
16
|
+
type PrimitiveAtom<Value> = WritableAtom<Value, [SetStateAction<Value>], void>;
|
|
17
|
+
type Getter = <Value>(value: Atom<Value>) => Value;
|
|
18
|
+
type Setter = <Value, Args$1 extends unknown[], Result$1>(value: WritableAtom<Value, Args$1, Result$1>, ...args: Args$1) => Result$1;
|
|
19
|
+
type AtomOptions = {
|
|
20
|
+
storage?: string;
|
|
21
|
+
};
|
|
22
|
+
declare function atom<Value, Args$1 extends unknown[], Result$1>(read: (get: Getter) => Value, write: (get: Getter, set: Setter, ...args: Args$1) => Result$1): WritableAtom<Value, Args$1, Result$1>;
|
|
23
|
+
declare function atom<Value>(read: (get: Getter) => Value): Atom<Value>;
|
|
24
|
+
declare function atom<Value>(initialValue: Value, options?: AtomOptions): PrimitiveAtom<Value>;
|
|
25
|
+
declare function useAtomValue<Value>(value: Atom<Value>): Awaited<Value>;
|
|
26
|
+
declare function useSetAtom<Value, Args$1 extends unknown[], Result$1>(value: WritableAtom<Value, Args$1, Result$1>): (...args: Args$1) => Result$1;
|
|
27
|
+
declare function useAtom<Value, Args$1 extends unknown[], Result$1>(value: WritableAtom<Value, Args$1, Result$1>): [Awaited<Value>, (...args: Args$1) => Result$1];
|
|
27
28
|
//#endregion
|
|
28
29
|
//#region src/state/collection.d.ts
|
|
29
|
-
|
|
30
|
-
type
|
|
31
|
-
type
|
|
32
|
-
type
|
|
33
|
-
type
|
|
34
|
-
type
|
|
35
|
-
type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
type CollectionReference = {
|
|
55
|
-
readonly name: string;
|
|
56
|
-
get(id: string): Promise<unknown>;
|
|
30
|
+
declare const collectionBrand: unique symbol;
|
|
31
|
+
type AnyShape = SchemaShape;
|
|
32
|
+
type AnyCollection = CollectionAtom<AnyShape>;
|
|
33
|
+
type Scalar = string | number | boolean;
|
|
34
|
+
type MaybePromise<Value> = Value | Promise<Value>;
|
|
35
|
+
type Order = 'asc' | 'desc';
|
|
36
|
+
type Comparison = 'equals' | 'greater-than' | 'less-than' | 'contains';
|
|
37
|
+
type ComparisonFor<Value> = Value extends number ? Exclude<Comparison, 'contains'> : Value extends string ? 'equals' | 'contains' : 'equals';
|
|
38
|
+
type WhereClauseValue<Value> = Value | readonly [ComparisonFor<Value>, Value] | ReadonlyArray<readonly [ComparisonFor<Value>, Value]>;
|
|
39
|
+
type ScalarFieldPath<Shape extends SchemaShape> = { [Key in Extract<keyof Shape, string>]: Shape[Key] extends {
|
|
40
|
+
kind: 'object';
|
|
41
|
+
shape: infer Nested extends SchemaShape;
|
|
42
|
+
} ? `${Key}.${ScalarFieldPath<Nested>}` : Shape[Key] extends {
|
|
43
|
+
kind: 'array';
|
|
44
|
+
} ? never : Key }[Extract<keyof Shape, string>];
|
|
45
|
+
type ScalarAtPath<Shape extends SchemaShape, Path$1 extends ScalarFieldPath<Shape>> = Path$1 extends `${infer Key}.${infer Rest}` ? Key extends keyof Shape ? Shape[Key] extends ObjectField<infer Nested> ? Rest extends ScalarFieldPath<Nested> ? ScalarAtPath<Nested, Rest> : never : never : never : Path$1 extends keyof Shape ? Extract<FieldOutput<Shape[Path$1]>, Scalar> : never;
|
|
46
|
+
type CollectionRow<Shape extends SchemaShape> = {
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly collection: string;
|
|
49
|
+
readonly version: number;
|
|
50
|
+
readonly createdAt: string;
|
|
51
|
+
readonly updatedAt: string;
|
|
52
|
+
readonly data: SchemaOutput<Shape>;
|
|
53
|
+
readonly links: Readonly<Record<string, readonly string[]>>;
|
|
57
54
|
};
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
interface CollectionAtom<Shape extends SchemaShape> extends Atom<Promise<readonly string[]>> {
|
|
56
|
+
readonly [collectionBrand]: Shape;
|
|
57
|
+
}
|
|
58
|
+
declare class CollectionVersionConflictError extends Error {
|
|
59
|
+
readonly collection: string;
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly expectedVersion: number;
|
|
62
|
+
readonly actualVersion: number;
|
|
63
|
+
readonly name = "CollectionVersionConflictError";
|
|
64
|
+
constructor(collection: string, id: string, expectedVersion: number, actualVersion: number);
|
|
65
|
+
}
|
|
66
|
+
type UpdateOptions = {
|
|
67
|
+
ifVersion?: number;
|
|
60
68
|
};
|
|
61
|
-
type
|
|
62
|
-
|
|
63
|
-
where?: Partial<Record<CollectionFieldKey<Shape>, ListWhereValue>>;
|
|
64
|
-
sortBy?: CollectionFieldKey<Shape> | 'createdAt' | 'updatedAt';
|
|
65
|
-
order?: 'asc' | 'desc';
|
|
66
|
-
take?: number;
|
|
69
|
+
type RowOptions = {
|
|
70
|
+
links?: readonly AnyCollection[];
|
|
67
71
|
};
|
|
68
|
-
type
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
type CollectionWhere<Shape extends SchemaShape> = Partial<{ [Path in ScalarFieldPath<Shape>]: WhereClauseValue<ScalarAtPath<Shape, Path>> }>;
|
|
73
|
+
type WhereClause = {
|
|
74
|
+
path: string;
|
|
75
|
+
comparison: Comparison;
|
|
76
|
+
operand: Scalar;
|
|
73
77
|
};
|
|
74
|
-
type
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
next: RawCollectionView | null;
|
|
79
|
-
changedPaths: Set<string>;
|
|
80
|
-
};
|
|
81
|
-
type EdgeChange = {
|
|
82
|
-
type: 'link' | 'unlink';
|
|
83
|
-
left: {
|
|
78
|
+
type QueryPlan = {
|
|
79
|
+
terminal: 'ids' | 'row' | 'field';
|
|
80
|
+
where: WhereClause[];
|
|
81
|
+
from?: {
|
|
84
82
|
collection: string;
|
|
85
83
|
id: string;
|
|
86
84
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
sort?: {
|
|
86
|
+
path: string;
|
|
87
|
+
order: Order;
|
|
90
88
|
};
|
|
89
|
+
take?: number;
|
|
90
|
+
id?: string;
|
|
91
|
+
path?: string;
|
|
92
|
+
links?: string[];
|
|
91
93
|
};
|
|
92
|
-
type
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
type QueryTerminal<Shape extends SchemaShape, Result$1> = {
|
|
95
|
+
readonly plan: QueryPlan;
|
|
96
|
+
readonly result?: Result$1;
|
|
97
|
+
readonly shape?: Shape;
|
|
96
98
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
interface QueryBuilder<Shape extends SchemaShape> {
|
|
100
|
+
where(filters: CollectionWhere<Shape>): QueryBuilder<Shape>;
|
|
101
|
+
from<OtherShape extends SchemaShape>(other: CollectionAtom<OtherShape>, id: string): QueryBuilder<Shape>;
|
|
102
|
+
sortBy(path: ScalarFieldPath<Shape> | 'createdAt' | 'updatedAt', order?: Order): QueryBuilder<Shape>;
|
|
103
|
+
take(count: number): QueryBuilder<Shape>;
|
|
104
|
+
ids(): QueryTerminal<Shape, readonly string[]>;
|
|
105
|
+
row(id: string, options?: RowOptions): QueryTerminal<Shape, CollectionRow<Shape> | null>;
|
|
106
|
+
field<Path$1 extends FieldPath<Shape>>(id: string, path: Path$1): QueryTerminal<Shape, ValueAtFieldPath<Shape, Path$1> | undefined>;
|
|
107
|
+
}
|
|
108
|
+
type InsertTerminal<Shape extends SchemaShape> = {
|
|
109
|
+
kind: 'insert';
|
|
110
|
+
args: [SchemaInput<Shape>];
|
|
111
|
+
result: string;
|
|
104
112
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
all(): Promise<CollectionView<Shape>[]>;
|
|
132
|
-
get(id: string): Promise<CollectionView<Shape> | null>;
|
|
133
|
-
subscribeRecord(id: string, listener: Listener): () => void;
|
|
134
|
-
subscribeList(options: ListOptions<Shape> | undefined, listener: Listener): () => void;
|
|
135
|
-
subscribeField(id: string, path: string, listener: Listener): () => void;
|
|
136
|
-
getRecordVersion(id: string): number;
|
|
137
|
-
getListVersion(options?: ListOptions<Shape>): number;
|
|
138
|
-
getFieldVersion(id: string, path: string): number;
|
|
139
|
-
getRecordSnapshot(id: string, options?: ViewOptions): CollectionView<Shape> | null | undefined;
|
|
140
|
-
getListSnapshot(options?: ListOptions<Shape>): string[] | undefined;
|
|
141
|
-
ensureRecord(id: string, options?: ViewOptions): Promise<RawCollectionView | null>;
|
|
142
|
-
ensureList(options?: ListOptions<Shape>): Promise<string[]>;
|
|
143
|
-
private deleteLinksForRecord;
|
|
113
|
+
type UpdateTerminal<Shape extends SchemaShape> = {
|
|
114
|
+
kind: 'update';
|
|
115
|
+
id: string;
|
|
116
|
+
args: [SchemaPatch<Shape>, UpdateOptions?];
|
|
117
|
+
result: CollectionRow<Shape>;
|
|
118
|
+
};
|
|
119
|
+
type RemoveTerminal = {
|
|
120
|
+
kind: 'remove';
|
|
121
|
+
id: string;
|
|
122
|
+
args: [];
|
|
123
|
+
result: boolean;
|
|
124
|
+
};
|
|
125
|
+
type LinkTerminal = {
|
|
126
|
+
kind: 'link' | 'unlink';
|
|
127
|
+
id: string;
|
|
128
|
+
other: AnyCollection;
|
|
129
|
+
args: [string];
|
|
130
|
+
result: boolean;
|
|
131
|
+
};
|
|
132
|
+
type MutationTerminal<Shape extends SchemaShape> = InsertTerminal<Shape> | UpdateTerminal<Shape> | RemoveTerminal | LinkTerminal;
|
|
133
|
+
interface MutationBuilder<Shape extends SchemaShape> {
|
|
134
|
+
insert(): InsertTerminal<Shape>;
|
|
135
|
+
update(id: string): UpdateTerminal<Shape>;
|
|
136
|
+
remove(id: string): RemoveTerminal;
|
|
137
|
+
link<OtherShape extends SchemaShape>(id: string, other: CollectionAtom<OtherShape>): LinkTerminal;
|
|
138
|
+
unlink<OtherShape extends SchemaShape>(id: string, other: CollectionAtom<OtherShape>): LinkTerminal;
|
|
144
139
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
declare function
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
140
|
+
type TerminalArgs<Terminal> = Terminal extends {
|
|
141
|
+
args: infer Args extends unknown[];
|
|
142
|
+
} ? Args : never;
|
|
143
|
+
type TerminalResult<Terminal> = Terminal extends {
|
|
144
|
+
result: infer Result;
|
|
145
|
+
} ? Result : never;
|
|
146
|
+
declare function atomCollection<const Shape extends SchemaShape>(name: string, shape: Shape): CollectionAtom<Shape>;
|
|
147
|
+
declare function queryAtom<Shape extends SchemaShape, Result$1>(collection: CollectionAtom<Shape>, build: (builder: QueryBuilder<Shape>) => QueryTerminal<Shape, Result$1>): Atom<Promise<Result$1>>;
|
|
148
|
+
declare function mutateAtom<Shape extends SchemaShape, Terminal extends MutationTerminal<Shape>>(collection: CollectionAtom<Shape>, build: (builder: MutationBuilder<Shape>) => Terminal): WritableAtom<null, TerminalArgs<Terminal>, Promise<TerminalResult<Terminal>>>;
|
|
149
|
+
interface TransactionContext {
|
|
150
|
+
get<Shape extends SchemaShape>(collection: CollectionAtom<Shape>, id: string, options?: RowOptions): Promise<CollectionRow<Shape> | null>;
|
|
151
|
+
query<Shape extends SchemaShape, Result$1>(collection: CollectionAtom<Shape>, build: (builder: QueryBuilder<Shape>) => QueryTerminal<Shape, Result$1>): Promise<Result$1>;
|
|
152
|
+
insert<Shape extends SchemaShape>(collection: CollectionAtom<Shape>, value: SchemaInput<Shape>): Promise<string>;
|
|
153
|
+
update<Shape extends SchemaShape>(collection: CollectionAtom<Shape>, id: string, patch: SchemaPatch<Shape>, options?: UpdateOptions): Promise<CollectionRow<Shape>>;
|
|
154
|
+
remove<Shape extends SchemaShape>(collection: CollectionAtom<Shape>, id: string): Promise<boolean>;
|
|
155
|
+
link<LeftShape extends SchemaShape, RightShape extends SchemaShape>(collection: CollectionAtom<LeftShape>, id: string, other: CollectionAtom<RightShape>, otherId: string): Promise<boolean>;
|
|
156
|
+
unlink<LeftShape extends SchemaShape, RightShape extends SchemaShape>(collection: CollectionAtom<LeftShape>, id: string, other: CollectionAtom<RightShape>, otherId: string): Promise<boolean>;
|
|
157
|
+
}
|
|
158
|
+
declare function transactionAtom<Args$1 extends unknown[], Result$1>(action: (context: TransactionContext, ...args: Args$1) => MaybePromise<Result$1>): WritableAtom<null, Args$1, Promise<Result$1>>;
|
|
159
|
+
declare function useList<Shape extends SchemaShape>(collection: CollectionAtom<Shape>, build?: (builder: QueryBuilder<Shape>) => QueryTerminal<Shape, readonly string[]>): readonly string[];
|
|
160
|
+
declare function useRow<Shape extends SchemaShape>(collection: CollectionAtom<Shape>, id: string, options?: RowOptions): CollectionRow<Shape> | null;
|
|
161
|
+
declare function useField<Shape extends SchemaShape, Path$1 extends FieldPath<Shape>>(collection: CollectionAtom<Shape>, id: string, path: Path$1): ValueAtFieldPath<Shape, Path$1> | undefined;
|
|
158
162
|
//#endregion
|
|
159
|
-
export { Atom,
|
|
163
|
+
export { type Atom, type AtomOptions, CollectionAtom, CollectionRow, CollectionVersionConflictError, CollectionWhere, type Getter, MutationBuilder, type PrimitiveAtom, QueryBuilder, RowOptions, type SetStateAction, type Setter, TransactionContext, UpdateOptions, type WritableAtom, array, atom, atomCollection, boolean, literal, mutateAtom, number, object, queryAtom, string, transactionAtom, useAtom, useAtomValue, useField, useList, useRow, useSetAtom };
|