@arcote.tech/arc 0.0.13 → 0.0.14
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/collection/collection-change.d.ts +1 -0
- package/dist/collection/collection.d.ts +35 -26
- package/dist/collection/db.d.ts +11 -12
- package/dist/collection/index.d.ts +1 -1
- package/dist/collection/queries/abstract-collection-query.d.ts +11 -14
- package/dist/collection/queries/abstract-many-items.d.ts +22 -13
- package/dist/collection/queries/all-items.d.ts +4 -3
- package/dist/collection/queries/indexed.d.ts +8 -8
- package/dist/collection/queries/one-item.d.ts +14 -6
- package/dist/collection/queries/util.d.ts +3 -6
- package/dist/collection/query-builders/abstract-many-items.d.ts +6 -6
- package/dist/collection/query-builders/all-items.d.ts +1 -0
- package/dist/collection/query-builders/indexed.d.ts +1 -0
- package/dist/collection/query-builders/one-item.d.ts +1 -0
- package/dist/context/commands.d.ts +3 -1
- package/dist/context/context.d.ts +13 -23
- package/dist/context/element.d.ts +7 -5
- package/dist/context/index.d.ts +4 -0
- package/dist/context/query-builders.d.ts +5 -2
- package/dist/context/query.d.ts +6 -2
- package/dist/data-storage/DataStorage.d.ts +11 -0
- package/dist/data-storage/ForkStoreState.d.ts +32 -0
- package/dist/data-storage/StoreState.d.ts +24 -0
- package/dist/data-storage/data-storage-forked.d.ts +16 -0
- package/dist/data-storage/data-storage-master.d.ts +20 -0
- package/dist/data-storage/data-storage.d.ts +2 -0
- package/dist/data-storage/data-storage.interface.d.ts +37 -0
- package/dist/data-storage/index.d.ts +7 -0
- package/dist/data-storage/master-store-state.d.ts +17 -0
- package/dist/data-storage/store-state-fork.d.ts +15 -0
- package/dist/data-storage/store-state-master.d.ts +14 -0
- package/dist/data-storage/store-state.abstract.d.ts +22 -0
- package/dist/data-storage/store-state.d.ts +24 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/interface.d.ts +17 -0
- package/dist/elements/abstract-primitive.d.ts +1 -0
- package/dist/elements/abstract.d.ts +1 -0
- package/dist/elements/array.d.ts +1 -0
- package/dist/elements/boolean.d.ts +1 -0
- package/dist/elements/branded.d.ts +1 -0
- package/dist/elements/date.d.ts +1 -0
- package/dist/elements/default.d.ts +1 -0
- package/dist/elements/element.d.ts +1 -0
- package/dist/elements/id.d.ts +1 -0
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/number.d.ts +1 -0
- package/dist/elements/object.d.ts +1 -0
- package/dist/elements/optional.d.ts +1 -0
- package/dist/elements/string-enum.d.ts +1 -0
- package/dist/elements/string.d.ts +1 -0
- package/dist/elements/tests/object.test.d.ts +2 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +429 -396
- package/dist/model/model.d.ts +18 -19
- package/dist/rtc/client.d.ts +2 -1
- package/dist/rtc/deserializeChanges.d.ts +1 -0
- package/dist/rtc/index.d.ts +1 -0
- package/dist/rtc/messages.d.ts +6 -5
- package/dist/rtc/rtc.d.ts +6 -0
- package/dist/state/db.d.ts +14 -0
- package/dist/state/index.d.ts +3 -0
- package/dist/state/query-builder.d.ts +8 -0
- package/dist/state/query.d.ts +22 -0
- package/dist/state/state-change.d.ts +13 -0
- package/dist/state/state.d.ts +28 -0
- package/dist/state/util.d.ts +2 -0
- package/dist/utils.d.ts +17 -14
- package/package.json +2 -2
- package/dist/collection/in-memory-db-proxy.d.ts +0 -10
- package/dist/elements/instanceOf.d.ts +0 -19
- package/dist/elements/or.d.ts +0 -11
- package/dist/elements/recurent.d.ts +0 -20
- package/dist/model/index.d.ts +0 -4
- package/dist/model/query-builder.d.ts +0 -3
- package/dist/model/rtc.d.ts +0 -6
- package/dist/model/submodel.d.ts +0 -23
package/dist/model/model.d.ts
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
import { Subject } from "rxjs";
|
|
2
|
-
import type { ArcCollectionAny, ArcIndexedCollectionAny } from "../collection";
|
|
3
|
-
import type { CollectionChange } from "../collection/collection-change";
|
|
4
|
-
import type { DatabaseAdapter, DBAdapterFactory, ReadWriteTransaction } from "../collection/db";
|
|
5
2
|
import type { CommandsClient } from "../context/commands";
|
|
6
|
-
import { type
|
|
3
|
+
import { type ArcContextChanges, type ArcContextWithCommandsAny } from "../context/context";
|
|
4
|
+
import type { ArcContextElementAny } from "../context/element";
|
|
7
5
|
import type { ArcQuery } from "../context/query";
|
|
8
|
-
import type { QueryFactoryFunction } from "
|
|
9
|
-
import type {
|
|
6
|
+
import type { QueryFactoryFunction } from "../context/query-builders";
|
|
7
|
+
import type { DatabaseAdapter, DBAdapterFactory, ReadWriteTransaction } from "../db";
|
|
8
|
+
import type { RealTimeCommunicationAdapter, RealTimeCommunicationAdapterFactory } from "../rtc/rtc";
|
|
10
9
|
export interface IArcModel<C extends ArcContextWithCommandsAny> {
|
|
11
10
|
readonly context: C;
|
|
12
|
-
changes$: Subject<
|
|
11
|
+
changes$: Subject<ArcContextChanges<C>>;
|
|
13
12
|
query(queryFactory: QueryFactoryFunction<C>): ArcQuery;
|
|
14
13
|
commands(): CommandsClient<C["commands"]>;
|
|
15
|
-
|
|
16
|
-
applyChanges(changes:
|
|
14
|
+
getContextElement(name: string): ArcContextElementAny;
|
|
15
|
+
applyChanges(changes: ArcContextChanges<C>[]): Promise<void>;
|
|
17
16
|
}
|
|
18
17
|
export declare class ArcModel<C extends ArcContextWithCommandsAny> implements IArcModel<C> {
|
|
19
18
|
readonly context: C;
|
|
20
|
-
rtc: RealTimeCommunicationAdapter
|
|
19
|
+
rtc: RealTimeCommunicationAdapter<C>;
|
|
21
20
|
dbAdapterPromise: Promise<DatabaseAdapter>;
|
|
22
|
-
changes$: Subject<
|
|
23
|
-
constructor(context: C, dbAdapterFactory: DBAdapterFactory, rtcAdapterFactory: RealTimeCommunicationAdapterFactory);
|
|
24
|
-
query(queryFactory: QueryFactoryFunction<C>):
|
|
21
|
+
changes$: Subject<ArcContextChanges<C>>;
|
|
22
|
+
constructor(context: C, dbAdapterFactory: DBAdapterFactory, rtcAdapterFactory: RealTimeCommunicationAdapterFactory<C>);
|
|
23
|
+
query(queryFactory: QueryFactoryFunction<C>): import("..").ArcQueryAny;
|
|
25
24
|
private runQuery;
|
|
26
25
|
commands(): CommandsClient<C["commands"]>;
|
|
27
26
|
executeCommand(command: C["commands"][string], ...args: any[]): Promise<{
|
|
28
|
-
changes:
|
|
27
|
+
changes: any;
|
|
29
28
|
result: any;
|
|
30
29
|
}>;
|
|
31
|
-
applyChangesForTransaction(transaction: ReadWriteTransaction, changes:
|
|
30
|
+
applyChangesForTransaction(transaction: ReadWriteTransaction, changes: ArcContextChanges<C>[]): Promise<void>;
|
|
32
31
|
private notifyChange;
|
|
33
|
-
applyChanges(changes:
|
|
34
|
-
|
|
32
|
+
applyChanges(changes: ArcContextChanges<C>[]): Promise<void>;
|
|
33
|
+
getContextElement(name: string): any;
|
|
35
34
|
}
|
|
36
35
|
export type ArcModelAny = ArcModel<ArcContextWithCommandsAny>;
|
|
37
|
-
export type ArcModelDependencies<C extends
|
|
36
|
+
export type ArcModelDependencies<C extends ArcContextWithCommandsAny> = {
|
|
38
37
|
dbAdapterFactory: DBAdapterFactory;
|
|
39
|
-
rtcAdapterFactory: RealTimeCommunicationAdapterFactory
|
|
38
|
+
rtcAdapterFactory: RealTimeCommunicationAdapterFactory<C>;
|
|
40
39
|
};
|
|
41
40
|
export declare function model<C extends ArcContextWithCommandsAny>(context: C, dependencies: ArcModelDependencies<C>): ArcModel<C>;
|
package/dist/rtc/client.d.ts
CHANGED
package/dist/rtc/index.d.ts
CHANGED
package/dist/rtc/messages.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StoreStateChange } from "../data-storage";
|
|
2
2
|
export type MessageClientToHost = {
|
|
3
3
|
type: "sync";
|
|
4
4
|
lastDate: string | null;
|
|
5
5
|
} | {
|
|
6
6
|
type: "changes-executed";
|
|
7
|
-
changes:
|
|
7
|
+
changes: StoreStateChange<any>[];
|
|
8
8
|
};
|
|
9
9
|
export type MessageHostToClient = {
|
|
10
10
|
type: "sync-result";
|
|
11
|
-
|
|
11
|
+
store: string;
|
|
12
12
|
items: any[];
|
|
13
13
|
} | {
|
|
14
|
-
type: "
|
|
15
|
-
changes:
|
|
14
|
+
type: "state-changes";
|
|
15
|
+
changes: StoreStateChange<any>[];
|
|
16
16
|
} | {
|
|
17
17
|
type: "sync-done";
|
|
18
18
|
date: string;
|
|
19
19
|
};
|
|
20
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DataStorage, StoreStateChange } from "../data-storage/data-storage.interface";
|
|
2
|
+
export interface RealTimeCommunicationAdapter {
|
|
3
|
+
commitChanges(changes: StoreStateChange<any>[]): void;
|
|
4
|
+
}
|
|
5
|
+
export type RealTimeCommunicationAdapterFactory = (storage: DataStorage) => RealTimeCommunicationAdapter;
|
|
6
|
+
//# sourceMappingURL=rtc.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReadTransaction, ReadWriteTransaction } from "../db/interface";
|
|
2
|
+
import type { ArcStateAny } from "./state";
|
|
3
|
+
import type { StateItem } from "./util";
|
|
4
|
+
export declare class StateReadTransaction {
|
|
5
|
+
protected dbTransaction: ReadTransaction;
|
|
6
|
+
constructor(dbTransaction: ReadTransaction);
|
|
7
|
+
find<S extends ArcStateAny>(state: S): Promise<StateItem<S> | undefined>;
|
|
8
|
+
}
|
|
9
|
+
export declare class StateReadWriteTransaction extends StateReadTransaction {
|
|
10
|
+
protected dbTransaction: ReadWriteTransaction;
|
|
11
|
+
constructor(dbTransaction: ReadWriteTransaction);
|
|
12
|
+
set<C extends ArcStateAny>(state: C, data: StateItem<C>): Promise<void>;
|
|
13
|
+
commit(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ArcQueryBuilder } from "../context/query-builders";
|
|
2
|
+
import { ArcStateQuery } from "./query";
|
|
3
|
+
import type { ArcStateAny } from "./state";
|
|
4
|
+
export declare class ArcStateQueryBuilder<S extends ArcStateAny> extends ArcQueryBuilder {
|
|
5
|
+
private collection;
|
|
6
|
+
constructor(collection: S);
|
|
7
|
+
toQuery(): ArcStateQuery<S>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Subject } from "rxjs";
|
|
2
|
+
import type { ArcQuery } from "../context/query";
|
|
3
|
+
import type { DatabaseAdapter } from "../db";
|
|
4
|
+
import { StateReadTransaction } from "./db";
|
|
5
|
+
import type { ArcStateAny } from "./state";
|
|
6
|
+
import type { StateChange } from "./state-change";
|
|
7
|
+
import type { StateItem } from "./util";
|
|
8
|
+
export declare class ArcStateQuery<State extends ArcStateAny> implements ArcQuery<StateItem<State>> {
|
|
9
|
+
protected state: State;
|
|
10
|
+
result$: Subject<StateItem<State>>;
|
|
11
|
+
private resultQueue$?;
|
|
12
|
+
private subscriptions;
|
|
13
|
+
constructor(state: State);
|
|
14
|
+
getLastResult(): StateItem<State>;
|
|
15
|
+
run(db: DatabaseAdapter, changes$: Subject<StateChange>): Promise<void>;
|
|
16
|
+
protected onChange(change: StateChange): any;
|
|
17
|
+
protected fetch(transaction: StateReadTransaction): Promise<ReturnType<State["deserialize"]> | undefined>;
|
|
18
|
+
private changeHandler;
|
|
19
|
+
unsubscribe(): void;
|
|
20
|
+
private nextResult;
|
|
21
|
+
isUnsubscribed(): boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Patches } from "mutative";
|
|
2
|
+
export type StateChange = {
|
|
3
|
+
state: string;
|
|
4
|
+
} & ({
|
|
5
|
+
type: "set";
|
|
6
|
+
body: any;
|
|
7
|
+
} | {
|
|
8
|
+
type: "mutate";
|
|
9
|
+
patches: Patches<any>;
|
|
10
|
+
});
|
|
11
|
+
export type StateEvent = Exclude<StateChange, {
|
|
12
|
+
type: "mutate";
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ArcContextElement } from "../context/element";
|
|
2
|
+
import type { ReadTransaction, ReadWriteTransaction } from "../db";
|
|
3
|
+
import { type ArcObjectAny } from "../elements/object";
|
|
4
|
+
import { objectUtil, type util } from "../utils";
|
|
5
|
+
import { ArcStateQueryBuilder } from "./query-builder";
|
|
6
|
+
import type { StateChange, StateEvent } from "./state-change";
|
|
7
|
+
import type { StateItem } from "./util";
|
|
8
|
+
type StateCommandContext<State extends ArcStateAny> = {
|
|
9
|
+
context: {
|
|
10
|
+
get: () => StateItem<State>;
|
|
11
|
+
};
|
|
12
|
+
finalize: () => StateChange[];
|
|
13
|
+
};
|
|
14
|
+
export declare class ArcState<Name extends string, Schema extends ArcObjectAny> implements ArcContextElement<StateChange, StateEvent> {
|
|
15
|
+
readonly name: Name;
|
|
16
|
+
readonly schema: Schema;
|
|
17
|
+
constructor(name: Name, schema: Schema);
|
|
18
|
+
serialize(data: objectUtil.simplify<objectUtil.addQuestionMarks<util.FirstArgument<Schema["serialize"]>>>): {
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
};
|
|
21
|
+
deserialize(data: objectUtil.simplify<objectUtil.addQuestionMarks<util.FirstArgument<Schema["deserialize"]>>>): ReturnType<Schema["deserialize"]>;
|
|
22
|
+
queryBuilder(): ArcStateQueryBuilder<this>;
|
|
23
|
+
commandContext(transaction: ReadTransaction): StateCommandContext<this>;
|
|
24
|
+
applyChange(transaction: ReadWriteTransaction, change: StateChange, events: StateChange[]): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export type ArcStateAny = ArcState<any, any>;
|
|
27
|
+
export declare function state<Name extends string, Schema extends ArcObjectAny>(name: Name, schema: Schema): ArcState<Name, Schema>;
|
|
28
|
+
export {};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArcCollectionAny, ArcIndexedCollectionAny } from "./collection/collection";
|
|
1
|
+
import type { ArcCollectionAny, ArcIndexedCollectionAny, CollectionItem } from "./collection/collection";
|
|
2
2
|
import type { QueryCollectionResult } from "./collection/queries/abstract-many-items";
|
|
3
3
|
import type { ArcElement } from "./elements/element";
|
|
4
4
|
export declare namespace objectUtil {
|
|
@@ -42,21 +42,24 @@ export declare namespace objectUtil {
|
|
|
42
42
|
export declare namespace util {
|
|
43
43
|
type FirstArgument<T> = T extends (arg: infer U, ...args: any[]) => any ? U : never;
|
|
44
44
|
type GetType<Element extends ArcElement> = ReturnType<Element["deserialize"]>;
|
|
45
|
-
type CollectionItemWithId<C extends ArcCollectionAny> = ReturnType<C["deserialize"]>;
|
|
45
|
+
type CollectionItemWithId<C extends ArcCollectionAny | ArcIndexedCollectionAny> = ReturnType<C["deserialize"]>;
|
|
46
46
|
}
|
|
47
47
|
export type ContextTypes<Ctx extends {
|
|
48
|
-
|
|
49
|
-
}> =
|
|
50
|
-
[
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
48
|
+
elements: any[];
|
|
49
|
+
}> = {
|
|
50
|
+
[key in keyof Ctx["elements"]]: Ctx["elements"][key] extends ArcCollectionAny | ArcIndexedCollectionAny ? {
|
|
51
|
+
[Collection in Ctx["elements"][number] as `${Collection["name"]}.bodyWithoutId`]: util.GetType<Collection["schema"]>;
|
|
52
|
+
} & {
|
|
53
|
+
[Collection in Ctx["elements"][number] as `${Collection["name"]}.setBody`]: objectUtil.addQuestionMarks<util.FirstArgument<Collection["schema"]["parse"]>>;
|
|
54
|
+
} & {
|
|
55
|
+
[Collection in Ctx["elements"][number] as `${Collection["name"]}.id`]: util.GetType<Collection["id"]>;
|
|
56
|
+
} & {
|
|
57
|
+
[Collection in Ctx["elements"][number] as `${Collection["name"]}.body`]: CollectionItem<Collection>;
|
|
58
|
+
} & {
|
|
59
|
+
[Collection in Ctx["elements"][number] as `${Collection["name"]}.queryCollectionResult`]: Omit<QueryCollectionResult<Collection>, "result">;
|
|
60
|
+
} : never;
|
|
61
|
+
}[keyof Ctx["elements"]];
|
|
60
62
|
export type infer<E extends {
|
|
61
63
|
deserialize: (...args: any) => any;
|
|
62
64
|
}> = ReturnType<E["deserialize"]>;
|
|
65
|
+
//# sourceMappingURL=utils.d.ts.map
|
package/package.json
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.14",
|
|
8
8
|
"private": false,
|
|
9
9
|
"author": "Przemysław Krasiński [arcote.tech]",
|
|
10
10
|
"description": "Arc is a framework designed to align code closely with business logic, streamlining development and enhancing productivity.",
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "bun build --target=node ./index.ts --outfile=dist/index.js --external rxjs --external mutative && bun run build:declaration",
|
|
13
|
-
"build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json",
|
|
13
|
+
"build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json --declarationMap",
|
|
14
14
|
"postbuild": "rimraf tsconfig.types.tsbuildinfo",
|
|
15
15
|
"type-check": "tsc",
|
|
16
16
|
"dev": "nodemon --ignore dist -e ts,tsx --exec 'bun run build'"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ArcCollectionAny } from "../collection";
|
|
2
|
-
import type { DatabaseAdapter, ReadTransaction, ReadWriteTransaction } from "../collection/db";
|
|
3
|
-
export declare class InMemoryDatabaseProxyAdapter implements DatabaseAdapter {
|
|
4
|
-
private parentAdapter;
|
|
5
|
-
private local;
|
|
6
|
-
constructor(parentAdapter: DatabaseAdapter);
|
|
7
|
-
readWriteTransaction(collections: ArcCollectionAny[]): ReadWriteTransaction;
|
|
8
|
-
readTransaction(collections: ArcCollectionAny[]): ReadTransaction;
|
|
9
|
-
clearLocal(): void;
|
|
10
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ArcElement } from "./element";
|
|
2
|
-
import type { ArcRawShape } from "./object";
|
|
3
|
-
import { ArcOptional } from "./optional";
|
|
4
|
-
export declare function ArcClass<E extends ArcRawShape>(shape: E): {
|
|
5
|
-
new (): { [key in keyof E]: ReturnType<E[key]["deserialize"]>; };
|
|
6
|
-
};
|
|
7
|
-
export declare class ArcInstanceOf<E> implements ArcElement {
|
|
8
|
-
private Class;
|
|
9
|
-
constructor(Class: {
|
|
10
|
-
new (): E;
|
|
11
|
-
});
|
|
12
|
-
serialize(value: unknown): unknown;
|
|
13
|
-
deserialize(value: unknown): E;
|
|
14
|
-
parse(value: unknown): unknown;
|
|
15
|
-
optional(): ArcOptional<this>;
|
|
16
|
-
}
|
|
17
|
-
export declare function instanceOf<E>(element: {
|
|
18
|
-
new (): E;
|
|
19
|
-
}): ArcInstanceOf<E>;
|
package/dist/elements/or.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { util } from "../utils";
|
|
2
|
-
import type { ArcElement } from "./element";
|
|
3
|
-
export declare class ArcOr<T extends ArcElement[]> implements ArcElement {
|
|
4
|
-
private elements;
|
|
5
|
-
constructor(elements: T);
|
|
6
|
-
serialize(value: util.FirstArgument<T[number]["serialize"]>): ReturnType<T[number]["serialize"]>;
|
|
7
|
-
deserialize(value: util.FirstArgument<T[number]["deserialize"]>): ReturnType<T[number]["deserialize"]>;
|
|
8
|
-
parse(value: util.FirstArgument<T[number]["parse"]>): ReturnType<T[number]["parse"]>;
|
|
9
|
-
private isTypeOf;
|
|
10
|
-
}
|
|
11
|
-
export declare function or<T extends ArcElement[]>(...elements: T): ArcOr<T>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type util } from "../utils";
|
|
2
|
-
import { ArcAbstract } from "./abstract";
|
|
3
|
-
import type { ArcElement } from "./element";
|
|
4
|
-
import { ArcOptional } from "./optional";
|
|
5
|
-
export declare class ArcRecurent<E extends ArcElement, Brand extends string | symbol> implements ArcElement {
|
|
6
|
-
private parent;
|
|
7
|
-
constructor(parent: E);
|
|
8
|
-
serialize(value: util.FirstArgument<E["serialize"]> & {
|
|
9
|
-
__brand: Brand;
|
|
10
|
-
}): ReturnType<E["serialize"]>;
|
|
11
|
-
deserialize(value: util.FirstArgument<E["deserialize"]>): ReturnType<E["deserialize"]> & {
|
|
12
|
-
__brand: Brand;
|
|
13
|
-
};
|
|
14
|
-
parse(value: util.FirstArgument<E["parse"]>): ReturnType<E["parse"]> & {
|
|
15
|
-
__brand: Brand;
|
|
16
|
-
};
|
|
17
|
-
optional(): ArcOptional<this>;
|
|
18
|
-
}
|
|
19
|
-
export type ArcRecurentAny = ArcRecurent<ArcAbstract, any>;
|
|
20
|
-
export declare function recurent<E extends () => ArcElement>(element: E): ArcRecurent<ArcElement, string | symbol>;
|
package/dist/model/index.d.ts
DELETED
package/dist/model/rtc.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CollectionChange } from "../collection/collection-change";
|
|
2
|
-
import type { ArcModelAny } from "./model";
|
|
3
|
-
export interface RealTimeCommunicationAdapter {
|
|
4
|
-
changesExecuted(changes: CollectionChange[]): void;
|
|
5
|
-
}
|
|
6
|
-
export type RealTimeCommunicationAdapterFactory = (model: ArcModelAny) => RealTimeCommunicationAdapter;
|
package/dist/model/submodel.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Subject } from "rxjs";
|
|
2
|
-
import type { ArcCollectionAny, ArcIndexedCollectionAny } from "../collection";
|
|
3
|
-
import type { CollectionChange } from "../collection/collection-change";
|
|
4
|
-
import type { CommandsClient } from "../context/commands";
|
|
5
|
-
import type { ArcContextWithCommandsAny } from "../context/context";
|
|
6
|
-
import type { ArcQuery } from "../context/query";
|
|
7
|
-
import { ArcModel, type IArcModel } from "./model";
|
|
8
|
-
import type { QueryFactoryFunction } from "./query-builder";
|
|
9
|
-
export declare class ArcSubModel<C extends ArcContextWithCommandsAny> implements IArcModel<C> {
|
|
10
|
-
private parentModel;
|
|
11
|
-
changes$: Subject<CollectionChange>;
|
|
12
|
-
private proxyAdapterPromise;
|
|
13
|
-
private uncommitedChanges;
|
|
14
|
-
constructor(parentModel: ArcModel<C>);
|
|
15
|
-
query(queryFactory: QueryFactoryFunction<C>): ArcQuery;
|
|
16
|
-
private runQuery;
|
|
17
|
-
commands(): CommandsClient<C["commands"]>;
|
|
18
|
-
private executeCommand;
|
|
19
|
-
getCollection(name: string): ArcCollectionAny | ArcIndexedCollectionAny;
|
|
20
|
-
applyChanges(changes: CollectionChange[]): Promise<void>;
|
|
21
|
-
get context(): C;
|
|
22
|
-
commitChanges(): Promise<void>;
|
|
23
|
-
}
|