@arcote.tech/arc 0.0.27 → 0.1.2
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.d.ts +28 -48
- package/dist/collection/queries/abstract-collection-query.d.ts +4 -6
- package/dist/collection/queries/{abstract-many-items.d.ts → find.d.ts} +8 -8
- package/dist/collection/queries/one-item.d.ts +1 -18
- package/dist/collection/query-builders/find-by-id.d.ts +2 -0
- package/dist/collection/query-builders/find-one.d.ts +2 -0
- package/dist/collection/query-builders/find.d.ts +13 -0
- package/dist/command/command.d.ts +29 -0
- package/dist/command/index.d.ts +2 -0
- package/dist/context/context.d.ts +34 -18
- package/dist/context/element.d.ts +36 -6
- package/dist/context/event.d.ts +39 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/query-builder-context.d.ts +15 -0
- package/dist/context/query-builders.d.ts +11 -2
- package/dist/context/query-cache.d.ts +9 -0
- package/dist/context/query.d.ts +5 -3
- package/dist/context/reactive-query.d.ts +23 -0
- package/dist/context/serializable-query.d.ts +11 -0
- package/dist/data-storage/store-state-fork.d.ts +2 -3
- package/dist/data-storage/store-state-master.d.ts +2 -5
- package/dist/data-storage/store-state.abstract.d.ts +2 -3
- package/dist/data-storage/types.d.ts +28 -0
- package/dist/db/index.d.ts +1 -0
- package/dist/db/interface.d.ts +2 -17
- package/dist/db/sqliteAdapter.d.ts +39 -0
- package/dist/dist/index.d.ts +513 -0
- package/dist/elements/abstract-primitive.d.ts +0 -1
- package/dist/elements/abstract.d.ts +2 -1
- package/dist/elements/array.d.ts +61 -3
- package/dist/elements/class.d.ts +1 -24
- package/dist/elements/date.d.ts +35 -2
- package/dist/elements/index.d.ts +2 -0
- package/dist/elements/number.d.ts +21 -6
- package/dist/elements/object.d.ts +38 -11
- package/dist/elements/or.d.ts +1 -11
- package/dist/elements/record.d.ts +16 -4
- package/dist/elements/string-enum.d.ts +17 -3
- package/dist/elements/string.d.ts +74 -6
- package/dist/elements/utils/type-validator-builder.d.ts +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1481 -752
- package/dist/model/index.d.ts +2 -0
- package/dist/model/model.d.ts +44 -38
- package/dist/state/query-builder.d.ts +1 -8
- package/dist/state/query.d.ts +1 -14
- package/dist/state/state.d.ts +1 -31
- package/dist/tests/context/context.test.d.ts +2 -0
- package/dist/tests/pipe.d.ts +2 -0
- package/dist/tests/query/advance-query.test.d.ts +2 -0
- package/dist/tests/query/collection-all.test.d.ts +2 -0
- package/dist/tests/utils/expect-not-false.d.ts +2 -0
- package/dist/tests/utils/sqlite-adapter.d.ts +3 -0
- package/dist/tests/utils/test-model.d.ts +26 -0
- package/dist/tests/validations/array.test.d.ts +2 -0
- package/dist/tests/validations/date.test.d.ts +2 -0
- package/dist/tests/validations/record.test.d.ts +2 -0
- package/dist/tests/validations/string-enum.test.d.ts +2 -0
- package/dist/utils/arcObjectToStoreSchema.d.ts +4 -0
- package/dist/utils/murmur-hash.d.ts +2 -0
- package/dist/utils.d.ts +4 -4
- package/dist/view/view.d.ts +49 -0
- package/package.json +11 -4
- package/dist/collection/collection-change.d.ts +0 -18
- package/dist/collection/db.d.ts +0 -17
- package/dist/collection/queries/all-items.d.ts +0 -7
- package/dist/collection/queries/indexed.d.ts +0 -13
- package/dist/collection/query-builders/abstract-many-items.d.ts +0 -11
- package/dist/collection/query-builders/all-items.d.ts +0 -9
- package/dist/collection/query-builders/indexed.d.ts +0 -11
- package/dist/collection/query-builders/one-item.d.ts +0 -11
- package/dist/collection/utils/index-query.d.ts +0 -6
- package/dist/data-storage/DataStorage.d.ts +0 -11
- package/dist/data-storage/ForkStoreState.d.ts +0 -32
- package/dist/data-storage/StoreState.d.ts +0 -39
- package/dist/data-storage/data-storage.d.ts +0 -2
- package/dist/data-storage/data-storage.interface.d.ts +0 -46
- package/dist/data-storage/master-store-state.d.ts +0 -30
- package/dist/data-storage/store-state.d.ts +0 -39
- package/dist/elements/object copy.d.ts +0 -29
- package/dist/rtc/deserializeChanges.d.ts +0 -3
- package/dist/state/db.d.ts +0 -15
- package/dist/state/state-change.d.ts +0 -14
- package/dist/state/util.d.ts +0 -3
- package/dist/tests/query/query.test.d.ts +0 -2
- package/dist/tests/query-notification-optimization.test copy.d.ts +0 -2
- package/dist/tests/query-notification-optimization.test.d.ts +0 -2
- package/dist/tests/validation.test.d.ts +0 -2
- package/dist/tests/validations/validation.test.d.ts +0 -2
- package/dist/utils/deep-merge.d.ts +0 -6
- /package/dist/{elements/tests → tests/validations}/object.test.d.ts +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ArcContextAny } from "../context";
|
|
2
|
+
import type { StoreTable } from "../context/element";
|
|
3
|
+
import type { FindOptions, WhereCondition } from "../data-storage/types";
|
|
4
|
+
import type { DatabaseAdapter, DBAdapterFactory, ReadTransaction, ReadWriteTransaction } from "./interface";
|
|
5
|
+
export interface SQLiteDatabase {
|
|
6
|
+
exec(sql: string, params?: any[]): Promise<any>;
|
|
7
|
+
}
|
|
8
|
+
declare class SQLiteReadTransaction implements ReadTransaction {
|
|
9
|
+
protected db: SQLiteDatabase;
|
|
10
|
+
protected tables: Map<string, StoreTable>;
|
|
11
|
+
constructor(db: SQLiteDatabase, tables: Map<string, StoreTable>);
|
|
12
|
+
protected getId(store: string, id: any): any;
|
|
13
|
+
protected buildWhereClause(where?: WhereCondition): {
|
|
14
|
+
sql: string;
|
|
15
|
+
params: any[];
|
|
16
|
+
};
|
|
17
|
+
protected getOperatorSymbol(operator: string): string;
|
|
18
|
+
protected buildOrderByClause(orderBy?: Record<string, "asc" | "desc">): string;
|
|
19
|
+
find<T>(store: string, options: FindOptions<T>): Promise<T[]>;
|
|
20
|
+
}
|
|
21
|
+
declare class SQLiteReadWriteTransaction extends SQLiteReadTransaction implements ReadWriteTransaction {
|
|
22
|
+
remove(store: string, id: any): Promise<void>;
|
|
23
|
+
set(store: string, item: any): Promise<void>;
|
|
24
|
+
commit(): Promise<void>;
|
|
25
|
+
private serializeValue;
|
|
26
|
+
}
|
|
27
|
+
export declare class SQLiteAdapter implements DatabaseAdapter {
|
|
28
|
+
private db;
|
|
29
|
+
private context;
|
|
30
|
+
private tables;
|
|
31
|
+
constructor(db: SQLiteDatabase, context: ArcContextAny);
|
|
32
|
+
initialize(): Promise<void>;
|
|
33
|
+
private createTableIfNotExists;
|
|
34
|
+
readWriteTransaction(stores?: string[]): SQLiteReadWriteTransaction;
|
|
35
|
+
readTransaction(stores?: string[]): SQLiteReadTransaction;
|
|
36
|
+
}
|
|
37
|
+
export declare const createSQLiteAdapterFactory: (db: SQLiteDatabase) => DBAdapterFactory;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=sqliteAdapter.d.ts.map
|
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
export function view(name: any, id3: any, schema: any): ArcView;
|
|
2
|
+
export function stringEnum(...values: any[]): ArcStringEnum;
|
|
3
|
+
export function string(): ArcString;
|
|
4
|
+
export function state(name: any, schema: any): ArcState;
|
|
5
|
+
export function rtcClientFactory(token: any): (storage: any) => RTCClient;
|
|
6
|
+
export function record(key: any, element: any): ArcRecord;
|
|
7
|
+
export function reactive(fn: any): (context2: any) => ReactiveQueryBuilder;
|
|
8
|
+
export function object(element: any): ArcObject;
|
|
9
|
+
export function number(): ArcNumber;
|
|
10
|
+
export function id(name: any): ArcId;
|
|
11
|
+
export function event(name: any, payload: any): ArcEvent;
|
|
12
|
+
export function date(): ArcDate;
|
|
13
|
+
export function customId(name: any, createFn: any): ArcCustomId;
|
|
14
|
+
export function createSQLiteAdapterFactory(db: any): (context3: any) => Promise<SQLiteAdapter>;
|
|
15
|
+
export function context(elementsPromise: any): Promise<ArcContext>;
|
|
16
|
+
export function command(name: any): ArcCommand;
|
|
17
|
+
export function collection(name: any, id3: any, schema: any, options?: {}): ArcCollection;
|
|
18
|
+
export function boolean(): ArcBoolean;
|
|
19
|
+
export function array(element: any): ArcArray;
|
|
20
|
+
export class StoreState {
|
|
21
|
+
constructor(storeName: any, dataStorage: any, deserialize: any);
|
|
22
|
+
storeName: any;
|
|
23
|
+
dataStorage: any;
|
|
24
|
+
deserialize: any;
|
|
25
|
+
listeners: Map<any, any>;
|
|
26
|
+
fork(): ForkedStoreState;
|
|
27
|
+
set(item: any): Promise<void>;
|
|
28
|
+
remove(id3: any): Promise<void>;
|
|
29
|
+
modify(id3: any, data: any): Promise<{
|
|
30
|
+
from: any;
|
|
31
|
+
to: any;
|
|
32
|
+
}>;
|
|
33
|
+
mutate(id3: any, editCallback: any): Promise<{
|
|
34
|
+
from: any;
|
|
35
|
+
to: any;
|
|
36
|
+
}>;
|
|
37
|
+
applySerializedChanges(changes: any): Promise<any[]>;
|
|
38
|
+
unsubscribe(listener: any): void;
|
|
39
|
+
notifyListeners(events: any): void;
|
|
40
|
+
}
|
|
41
|
+
export class SQLiteAdapter {
|
|
42
|
+
constructor(db: any, context3: any);
|
|
43
|
+
db: any;
|
|
44
|
+
context: any;
|
|
45
|
+
tables: Map<any, any>;
|
|
46
|
+
initialize(): Promise<void>;
|
|
47
|
+
createTableIfNotExists(table: any): Promise<void>;
|
|
48
|
+
readWriteTransaction(stores: any): SQLiteReadWriteTransaction;
|
|
49
|
+
readTransaction(stores: any): SQLiteReadTransaction;
|
|
50
|
+
}
|
|
51
|
+
export class RemoteModelClient extends ModelBase {
|
|
52
|
+
constructor(context3: any, apiBaseUrl: any, client: any, catchErrorCallback: any);
|
|
53
|
+
context: any;
|
|
54
|
+
apiBaseUrl: any;
|
|
55
|
+
client: any;
|
|
56
|
+
catchErrorCallback: any;
|
|
57
|
+
query(queryBuilderFn: any): Promise<any>;
|
|
58
|
+
subscribe(queryBuilderFn: any, callback: any): {
|
|
59
|
+
unsubscribe: () => void;
|
|
60
|
+
result: Promise<any>;
|
|
61
|
+
};
|
|
62
|
+
commands(): {};
|
|
63
|
+
}
|
|
64
|
+
export class ModelBase {
|
|
65
|
+
}
|
|
66
|
+
export class Model extends ModelBase {
|
|
67
|
+
constructor(context3: any, dataStorage: any, client: any, catchErrorCallback: any);
|
|
68
|
+
context: any;
|
|
69
|
+
dataStorage: any;
|
|
70
|
+
client: any;
|
|
71
|
+
catchErrorCallback: any;
|
|
72
|
+
queryCache: QueryCache;
|
|
73
|
+
query(queryBuilderFn: any): Promise<any>;
|
|
74
|
+
subscribe(queryBuilderFn: any, callback: any): {
|
|
75
|
+
unsubscribe: () => void;
|
|
76
|
+
result: any;
|
|
77
|
+
};
|
|
78
|
+
commands(): any;
|
|
79
|
+
fork(): ForkedModel;
|
|
80
|
+
get $debug(): {};
|
|
81
|
+
}
|
|
82
|
+
export class MasterStoreState extends StoreState {
|
|
83
|
+
applyChangeAndReturnEvent(transaction: any, change: any): Promise<{
|
|
84
|
+
from: null;
|
|
85
|
+
to: any;
|
|
86
|
+
event: {
|
|
87
|
+
type: string;
|
|
88
|
+
item: any;
|
|
89
|
+
id: any;
|
|
90
|
+
};
|
|
91
|
+
}>;
|
|
92
|
+
applyChange(change: any): Promise<{
|
|
93
|
+
from: null;
|
|
94
|
+
to: any;
|
|
95
|
+
}>;
|
|
96
|
+
applyChanges(changes: any): Promise<void>;
|
|
97
|
+
find(options: any, listener: any): Promise<any>;
|
|
98
|
+
}
|
|
99
|
+
export class MasterDataStorage extends DataStorage {
|
|
100
|
+
constructor(dbAdapter: any, rtcAdapterFactory: any, arcContext: any);
|
|
101
|
+
dbAdapter: any;
|
|
102
|
+
arcContext: any;
|
|
103
|
+
stores: Map<any, any>;
|
|
104
|
+
rtcAdapter: any;
|
|
105
|
+
getReadTransaction(): Promise<any>;
|
|
106
|
+
getReadWriteTransaction(): Promise<any>;
|
|
107
|
+
getStore(storeName: any): any;
|
|
108
|
+
applyChanges(changes: any): Promise<any[]>;
|
|
109
|
+
applySerializedChanges(changes: any): Promise<any[]>;
|
|
110
|
+
fork(): ForkedDataStorage;
|
|
111
|
+
sync(progressCallback: any): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
export class ForkedStoreState extends StoreState {
|
|
114
|
+
master: any;
|
|
115
|
+
changedItems: Map<any, any>;
|
|
116
|
+
changes: any[];
|
|
117
|
+
applyChangeAndReturnEvent(change: any): Promise<{
|
|
118
|
+
from: any;
|
|
119
|
+
to: any;
|
|
120
|
+
event: {
|
|
121
|
+
type: string;
|
|
122
|
+
item: any;
|
|
123
|
+
id: any;
|
|
124
|
+
};
|
|
125
|
+
}>;
|
|
126
|
+
applyChange(change: any): Promise<{
|
|
127
|
+
from: any;
|
|
128
|
+
to: any;
|
|
129
|
+
}>;
|
|
130
|
+
applyChanges(changes: any): Promise<void>;
|
|
131
|
+
find(options: any, listener: any): Promise<any[]>;
|
|
132
|
+
}
|
|
133
|
+
export class ForkedModel extends Model {
|
|
134
|
+
merge(): void;
|
|
135
|
+
}
|
|
136
|
+
export class ForkedDataStorage extends DataStorage {
|
|
137
|
+
constructor(master: any);
|
|
138
|
+
master: any;
|
|
139
|
+
stores: Map<any, any>;
|
|
140
|
+
getReadTransaction(): any;
|
|
141
|
+
getReadWriteTransaction(): any;
|
|
142
|
+
getStore(storeName: any): any;
|
|
143
|
+
fork(): ForkedDataStorage;
|
|
144
|
+
merge(): Promise<void>;
|
|
145
|
+
}
|
|
146
|
+
export class DataStorage {
|
|
147
|
+
commitChanges(changes: any): Promise<void>;
|
|
148
|
+
}
|
|
149
|
+
export class ArcView extends ArcContextElementWithStore {
|
|
150
|
+
constructor(name: any, id3: any, schema: any);
|
|
151
|
+
id: any;
|
|
152
|
+
schema: any;
|
|
153
|
+
_description: any;
|
|
154
|
+
_elements: any;
|
|
155
|
+
_handler: any;
|
|
156
|
+
storeSchema: () => {
|
|
157
|
+
tables: {
|
|
158
|
+
name: any;
|
|
159
|
+
columns: any;
|
|
160
|
+
primaryKey: string;
|
|
161
|
+
}[];
|
|
162
|
+
};
|
|
163
|
+
use(elements: any): ArcView;
|
|
164
|
+
description(description: any): ArcView;
|
|
165
|
+
handle(handler: any): ArcView;
|
|
166
|
+
queryBuilder: (context3: any) => {
|
|
167
|
+
find: (options: any) => never;
|
|
168
|
+
};
|
|
169
|
+
commandContext: (dataStorage: any, publishEvent: any) => {
|
|
170
|
+
find: (options: any) => Promise<any>;
|
|
171
|
+
findOne: (where: any) => Promise<any>;
|
|
172
|
+
};
|
|
173
|
+
observer: () => {};
|
|
174
|
+
clone(): ArcView;
|
|
175
|
+
}
|
|
176
|
+
export class ArcStringEnum extends ArcAbstract {
|
|
177
|
+
constructor(values: any);
|
|
178
|
+
values: any;
|
|
179
|
+
parse(value: any): any;
|
|
180
|
+
serialize(value: any): any;
|
|
181
|
+
deserialize(value: any): any;
|
|
182
|
+
getEnumerators(): any;
|
|
183
|
+
}
|
|
184
|
+
export class ArcString extends ArcPrimitive {
|
|
185
|
+
constructor();
|
|
186
|
+
minLength(min: any): any;
|
|
187
|
+
maxLength(max: any): any;
|
|
188
|
+
length(number: any): any;
|
|
189
|
+
includes(str: any): any;
|
|
190
|
+
startsWith(str: any): any;
|
|
191
|
+
endsWith(str: any): any;
|
|
192
|
+
regex(regex: any): any;
|
|
193
|
+
email(): any;
|
|
194
|
+
url(): any;
|
|
195
|
+
ip(): any;
|
|
196
|
+
validation(name: any, validator: any): any;
|
|
197
|
+
}
|
|
198
|
+
export class ArcState extends ArcContextElement {
|
|
199
|
+
constructor(name: any, schema: any);
|
|
200
|
+
schema: any;
|
|
201
|
+
serialize(data: any): any;
|
|
202
|
+
deserialize(data: any): any;
|
|
203
|
+
queryBuilder(context3: any): ArcStateQueryBuilder;
|
|
204
|
+
commandContext(dataStorage: any, publishEvent: any): {
|
|
205
|
+
get: () => Promise<any>;
|
|
206
|
+
modify: (data: any) => Promise<void>;
|
|
207
|
+
edit: (editCallback: any) => Promise<void>;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
export class ArcRecord extends ArcAbstract {
|
|
211
|
+
constructor(key: any, element: any);
|
|
212
|
+
key: any;
|
|
213
|
+
element: any;
|
|
214
|
+
parse(value: any): {};
|
|
215
|
+
serialize(value: any): {};
|
|
216
|
+
deserialize(value: any): {};
|
|
217
|
+
}
|
|
218
|
+
export class ArcQueryBuilder {
|
|
219
|
+
constructor(queryContext: any);
|
|
220
|
+
queryContext: any;
|
|
221
|
+
run(): any;
|
|
222
|
+
}
|
|
223
|
+
export class ArcQuery {
|
|
224
|
+
lastResult: any;
|
|
225
|
+
listeners: Set<any>;
|
|
226
|
+
subscribe(listener: any): void;
|
|
227
|
+
unsubscribe(listener: any): void;
|
|
228
|
+
nextResult(result: any): void;
|
|
229
|
+
}
|
|
230
|
+
export class ArcOptional {
|
|
231
|
+
constructor(parent: any);
|
|
232
|
+
parent: any;
|
|
233
|
+
parse(value: any): any;
|
|
234
|
+
serialize(value: any): any;
|
|
235
|
+
deserialize(value: any): any;
|
|
236
|
+
validate(value: any): any;
|
|
237
|
+
}
|
|
238
|
+
export class ArcObject extends ArcAbstract {
|
|
239
|
+
constructor(rawShape: any);
|
|
240
|
+
rawShape: any;
|
|
241
|
+
parse(value: any): {};
|
|
242
|
+
serialize(value: any): {};
|
|
243
|
+
deserialize(value: any): {
|
|
244
|
+
[k: string]: any;
|
|
245
|
+
};
|
|
246
|
+
deserializePath(path: any, value: any): any;
|
|
247
|
+
parsePartial(value: any): {};
|
|
248
|
+
deserializePartial(value: any): {};
|
|
249
|
+
serializePartial(value: any): {};
|
|
250
|
+
pick(...keys: any[]): ArcObject;
|
|
251
|
+
omit(...keys: any[]): ArcObject;
|
|
252
|
+
entries(): [string, any][];
|
|
253
|
+
}
|
|
254
|
+
export class ArcNumber extends ArcPrimitive {
|
|
255
|
+
constructor();
|
|
256
|
+
min(min: any): any;
|
|
257
|
+
max(max: any): any;
|
|
258
|
+
validation(name: any, validator: any): any;
|
|
259
|
+
}
|
|
260
|
+
export class ArcId extends ArcBranded {
|
|
261
|
+
constructor(name: any);
|
|
262
|
+
generate(): string;
|
|
263
|
+
}
|
|
264
|
+
export class ArcEvent extends ArcContextElementWithStore {
|
|
265
|
+
constructor(name: any, payload: any);
|
|
266
|
+
payload: any;
|
|
267
|
+
storeSchema: () => {
|
|
268
|
+
tables: {
|
|
269
|
+
name: string;
|
|
270
|
+
columns: {
|
|
271
|
+
name: string;
|
|
272
|
+
type: string;
|
|
273
|
+
}[];
|
|
274
|
+
}[];
|
|
275
|
+
};
|
|
276
|
+
commandContext: (dataStorage: any, publishEvent: any) => {
|
|
277
|
+
emit: (payload: any) => Promise<void>;
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
export class ArcDate extends ArcAbstract {
|
|
281
|
+
constructor();
|
|
282
|
+
parse(value: any): Date;
|
|
283
|
+
serialize(value: any): any;
|
|
284
|
+
deserialize(value: any): Date;
|
|
285
|
+
after(after: any): any;
|
|
286
|
+
before(before: any): any;
|
|
287
|
+
validation(name: any, validator: any): any;
|
|
288
|
+
}
|
|
289
|
+
export class ArcCustomId extends ArcBranded {
|
|
290
|
+
createFn: any;
|
|
291
|
+
get(...args: any[]): any;
|
|
292
|
+
}
|
|
293
|
+
export class ArcContext {
|
|
294
|
+
constructor(elements: any);
|
|
295
|
+
elements: any;
|
|
296
|
+
eventListeners: Map<any, any>;
|
|
297
|
+
pipe(newElements: any): ArcContext;
|
|
298
|
+
queryBuilder(queryContext: any): {};
|
|
299
|
+
commandContext(client: any, dataStorage: any): {};
|
|
300
|
+
commandsClient(client: any, queryContext: any, dataStorage: any, catchErrorCallback: any): {};
|
|
301
|
+
}
|
|
302
|
+
export class ArcCommand extends ArcContextElement {
|
|
303
|
+
constructor(name: any);
|
|
304
|
+
_description: any;
|
|
305
|
+
_params: any;
|
|
306
|
+
_result: any;
|
|
307
|
+
_elements: any;
|
|
308
|
+
_handler: any;
|
|
309
|
+
use(elements: any): ArcCommand;
|
|
310
|
+
description(description: any): ArcCommand;
|
|
311
|
+
withParams(schema: any): ArcCommand;
|
|
312
|
+
withResult(schema: any): ArcCommand;
|
|
313
|
+
handle(handler: any): ArcCommand;
|
|
314
|
+
commandClient: (ctx: any) => ((params: any) => Promise<any>) & {
|
|
315
|
+
params: any;
|
|
316
|
+
};
|
|
317
|
+
clone(): ArcCommand;
|
|
318
|
+
}
|
|
319
|
+
export class ArcCollectionQuery extends ArcSerializableQuery {
|
|
320
|
+
constructor(collection: any, params: any);
|
|
321
|
+
collection: any;
|
|
322
|
+
bindedChangeHandler: (changes: any) => void;
|
|
323
|
+
store: any;
|
|
324
|
+
run(dataStorage: any): Promise<any>;
|
|
325
|
+
changeHandler(changes: any): void;
|
|
326
|
+
}
|
|
327
|
+
export class ArcCollection extends ArcContextElementWithStore {
|
|
328
|
+
constructor(name: any, id3: any, schema: any, options: any);
|
|
329
|
+
id: any;
|
|
330
|
+
schema: any;
|
|
331
|
+
options: any;
|
|
332
|
+
storeSchema(): {
|
|
333
|
+
tables: {
|
|
334
|
+
name: any;
|
|
335
|
+
columns: any;
|
|
336
|
+
primaryKey: string;
|
|
337
|
+
}[];
|
|
338
|
+
};
|
|
339
|
+
serialize(data: any): any;
|
|
340
|
+
deserialize(data: any): any;
|
|
341
|
+
queryBuilder(context: any): {
|
|
342
|
+
find: (options: any) => ArcFindQueryBuilder;
|
|
343
|
+
};
|
|
344
|
+
commandContext: (dataStorage: any, publishEvent: any) => {
|
|
345
|
+
add: (data: any) => Promise<{
|
|
346
|
+
id: any;
|
|
347
|
+
}>;
|
|
348
|
+
remove: (id3: any) => Promise<{
|
|
349
|
+
success: boolean;
|
|
350
|
+
}>;
|
|
351
|
+
set: (id3: any, data: any) => Promise<{
|
|
352
|
+
success: boolean;
|
|
353
|
+
}>;
|
|
354
|
+
find: (options: any) => Promise<any>;
|
|
355
|
+
findOne: (where: any) => Promise<any>;
|
|
356
|
+
modify: (id3: any, data: any) => Promise<void>;
|
|
357
|
+
edit: (id3: any, editCallback: any) => Promise<void>;
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
export class ArcBranded {
|
|
361
|
+
constructor(parent: any, brand: any);
|
|
362
|
+
parent: any;
|
|
363
|
+
brand: any;
|
|
364
|
+
serialize(value: any): any;
|
|
365
|
+
deserialize(value: any): any;
|
|
366
|
+
parse(value: any): any;
|
|
367
|
+
optional(): ArcOptional;
|
|
368
|
+
validate(value: any): any;
|
|
369
|
+
}
|
|
370
|
+
export class ArcBoolean extends ArcPrimitive {
|
|
371
|
+
}
|
|
372
|
+
export class ArcArray extends ArcAbstract {
|
|
373
|
+
constructor(parent: any);
|
|
374
|
+
parent: any;
|
|
375
|
+
minLength(min: any): any;
|
|
376
|
+
maxLength(max: any): any;
|
|
377
|
+
length(number: any): any;
|
|
378
|
+
nonEmpty(): any;
|
|
379
|
+
parse(value: any): any;
|
|
380
|
+
serialize(value: any): any;
|
|
381
|
+
deserialize(value: any): any[];
|
|
382
|
+
deserializePath(path: any, value: any): any;
|
|
383
|
+
validation(name: any, validator: any): any;
|
|
384
|
+
}
|
|
385
|
+
declare class RTCClient {
|
|
386
|
+
constructor(storage: any, token: any);
|
|
387
|
+
storage: any;
|
|
388
|
+
token: any;
|
|
389
|
+
_socket: any;
|
|
390
|
+
openSocket: any;
|
|
391
|
+
reconnectAttempts: number;
|
|
392
|
+
maxReconnectAttempts: number;
|
|
393
|
+
syncProgressCallback: any;
|
|
394
|
+
syncPromise: null;
|
|
395
|
+
sync(progressCallback: any): Promise<null>;
|
|
396
|
+
performSync(): Promise<void>;
|
|
397
|
+
connectWebSocket(): Promise<void>;
|
|
398
|
+
reconnect(): void;
|
|
399
|
+
commitChanges(changes: any): Promise<void>;
|
|
400
|
+
onMessage(message: any): void;
|
|
401
|
+
sendMessage(message: any): Promise<void>;
|
|
402
|
+
}
|
|
403
|
+
declare class ReactiveQueryBuilder {
|
|
404
|
+
constructor(queryBuilder: any, fn: any);
|
|
405
|
+
queryBuilder: any;
|
|
406
|
+
fn: any;
|
|
407
|
+
toQuery(context2: any): ReactiveQuery;
|
|
408
|
+
}
|
|
409
|
+
declare class SQLiteReadWriteTransaction extends SQLiteReadTransaction {
|
|
410
|
+
remove(store: any, id3: any): Promise<void>;
|
|
411
|
+
set(store: any, item: any): Promise<void>;
|
|
412
|
+
commit(): Promise<void>;
|
|
413
|
+
serializeValue(value: any): any;
|
|
414
|
+
}
|
|
415
|
+
declare class SQLiteReadTransaction {
|
|
416
|
+
constructor(db: any, tables: any);
|
|
417
|
+
db: any;
|
|
418
|
+
tables: any;
|
|
419
|
+
getId(store: any, id3: any): any;
|
|
420
|
+
buildWhereClause(where: any): {
|
|
421
|
+
sql: string;
|
|
422
|
+
params: any[];
|
|
423
|
+
};
|
|
424
|
+
getOperatorSymbol(operator: any): any;
|
|
425
|
+
buildOrderByClause(orderBy: any): string;
|
|
426
|
+
find(store: any, options: any): Promise<any>;
|
|
427
|
+
}
|
|
428
|
+
declare class QueryCache {
|
|
429
|
+
cache: Map<any, any>;
|
|
430
|
+
getIndexHash(value: any): any;
|
|
431
|
+
set(index: any, query2: any): void;
|
|
432
|
+
get(index: any): any;
|
|
433
|
+
debug(): Map<any, any>;
|
|
434
|
+
}
|
|
435
|
+
declare class ArcContextElementWithStore extends ArcContextElement {
|
|
436
|
+
}
|
|
437
|
+
declare class ArcAbstract {
|
|
438
|
+
constructor(validations?: any[]);
|
|
439
|
+
validations: any[];
|
|
440
|
+
default(defaultValueOrCallback: any): ArcDefault;
|
|
441
|
+
optional(): ArcOptional;
|
|
442
|
+
branded(name: any): ArcBranded;
|
|
443
|
+
clone(): any;
|
|
444
|
+
validate(value: any): any;
|
|
445
|
+
pipeValidation(name: any, validator: any): any;
|
|
446
|
+
getValidations(): any[];
|
|
447
|
+
}
|
|
448
|
+
declare class ArcPrimitive extends ArcAbstract {
|
|
449
|
+
serialize(value: any): any;
|
|
450
|
+
parse(value: any): any;
|
|
451
|
+
deserialize(value: any): any;
|
|
452
|
+
}
|
|
453
|
+
declare class ArcContextElement {
|
|
454
|
+
$event: any;
|
|
455
|
+
name: any;
|
|
456
|
+
commandContext: any;
|
|
457
|
+
commandClient: any;
|
|
458
|
+
observer: any;
|
|
459
|
+
}
|
|
460
|
+
declare class ArcStateQueryBuilder extends ArcQueryBuilder {
|
|
461
|
+
constructor(state: any, context3: any);
|
|
462
|
+
state: any;
|
|
463
|
+
toQuery(): ArcStateQuery;
|
|
464
|
+
}
|
|
465
|
+
declare class ArcSerializableQuery extends ArcQuery {
|
|
466
|
+
static key: any;
|
|
467
|
+
constructor(params: any);
|
|
468
|
+
params: any;
|
|
469
|
+
serialize(): {
|
|
470
|
+
key: any;
|
|
471
|
+
params: any;
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
declare class ArcFindQueryBuilder {
|
|
475
|
+
constructor(collection: any, queryContext: any, options: any);
|
|
476
|
+
collection: any;
|
|
477
|
+
queryContext: any;
|
|
478
|
+
options: any;
|
|
479
|
+
toQuery(): any;
|
|
480
|
+
run(): any;
|
|
481
|
+
}
|
|
482
|
+
declare class ReactiveQuery extends ArcQuery {
|
|
483
|
+
constructor(queryContext: any, queryBuilder: any, fn: any);
|
|
484
|
+
queryContext: any;
|
|
485
|
+
queryBuilder: any;
|
|
486
|
+
fn: any;
|
|
487
|
+
queries: any[];
|
|
488
|
+
run(): Promise<any>;
|
|
489
|
+
onChangeHandler: () => Promise<void>;
|
|
490
|
+
onChange(): Promise<void>;
|
|
491
|
+
runQuery(): Promise<any>;
|
|
492
|
+
}
|
|
493
|
+
declare class ArcDefault {
|
|
494
|
+
constructor(parent: any, defaultValueOrCallback: any);
|
|
495
|
+
parent: any;
|
|
496
|
+
defaultValueOrCallback: any;
|
|
497
|
+
validate(value: any): void;
|
|
498
|
+
parse(value: any): any;
|
|
499
|
+
serialize(value: any): any;
|
|
500
|
+
deserialize(value: any): any;
|
|
501
|
+
}
|
|
502
|
+
declare class ArcStateQuery extends ArcQuery {
|
|
503
|
+
constructor(state: any);
|
|
504
|
+
state: any;
|
|
505
|
+
bindedChangeHandler: (changes: any) => void;
|
|
506
|
+
store: any;
|
|
507
|
+
run(dataStorage: any): Promise<any>;
|
|
508
|
+
onChange(change: any): any;
|
|
509
|
+
changeHandler(changes: any): void;
|
|
510
|
+
unsubscribe(): void;
|
|
511
|
+
}
|
|
512
|
+
export {};
|
|
513
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -11,6 +11,7 @@ export type Validators = Validator<any>[];
|
|
|
11
11
|
export type GetValidator<A extends ArcAbstract<any>> = A extends ArcAbstract<infer T> ? T : [];
|
|
12
12
|
export declare abstract class ArcAbstract<V extends Validators> implements ArcElement {
|
|
13
13
|
protected validations: V;
|
|
14
|
+
constructor(validations?: V);
|
|
14
15
|
abstract serialize(value: any): any;
|
|
15
16
|
abstract deserialize(value: any): any;
|
|
16
17
|
abstract parse(value: any): any;
|
|
@@ -18,7 +19,7 @@ export declare abstract class ArcAbstract<V extends Validators> implements ArcEl
|
|
|
18
19
|
optional(): ArcOptional<this>;
|
|
19
20
|
branded<Brand extends string | symbol>(name: Brand): ArcBranded<this, Brand>;
|
|
20
21
|
protected clone(): this;
|
|
21
|
-
validate(value: any): { [Key in V[number] as Key["name"]]: ReturnType<Key["validator"]>; };
|
|
22
|
+
validate(value: any): false | { [Key in V[number] as Key["name"]]: ReturnType<Key["validator"]>; };
|
|
22
23
|
protected pipeValidation<Name extends string, Val extends CheckFn<any>>(name: Name, validator: Val): ArcAbstract<[...V, {
|
|
23
24
|
name: Name;
|
|
24
25
|
validator: Val;
|
package/dist/elements/array.d.ts
CHANGED
|
@@ -1,14 +1,72 @@
|
|
|
1
1
|
import { type util } from "../utils";
|
|
2
|
-
import { ArcAbstract } from "./abstract";
|
|
2
|
+
import { ArcAbstract, type CheckFn, type GetValidator, type Validators } from "./abstract";
|
|
3
3
|
import type { ArcElement } from "./element";
|
|
4
|
-
|
|
4
|
+
declare const arrayValidator: {
|
|
5
|
+
name: "type";
|
|
6
|
+
validator: (value: any) => false | {
|
|
7
|
+
current: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
8
|
+
expected: "array";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare class ArcArray<E extends ArcElement, V extends Validators = [
|
|
12
|
+
typeof arrayValidator,
|
|
13
|
+
{
|
|
14
|
+
name: "schema";
|
|
15
|
+
validator: (values: any[]) => {
|
|
16
|
+
[index: number]: ReturnType<E["validate"]>;
|
|
17
|
+
} | false;
|
|
18
|
+
}
|
|
19
|
+
]> extends ArcAbstract<V> {
|
|
5
20
|
private parent;
|
|
6
21
|
constructor(parent: E);
|
|
22
|
+
minLength(min: number): ArcArray<E, [...V, {
|
|
23
|
+
name: "minLength";
|
|
24
|
+
validator: (value: any[]) => {
|
|
25
|
+
currentLength: number;
|
|
26
|
+
minLength: number;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}]>;
|
|
29
|
+
maxLength(max: number): ArcArray<E, [...V, {
|
|
30
|
+
name: "maxLength";
|
|
31
|
+
validator: (value: any[]) => {
|
|
32
|
+
currentLength: number;
|
|
33
|
+
maxLength: number;
|
|
34
|
+
} | undefined;
|
|
35
|
+
}]>;
|
|
36
|
+
length(number: number): ArcArray<E, [...V, {
|
|
37
|
+
name: "length";
|
|
38
|
+
validator: (value: any[]) => {
|
|
39
|
+
currentLength: number;
|
|
40
|
+
length: number;
|
|
41
|
+
} | undefined;
|
|
42
|
+
}]>;
|
|
43
|
+
nonEmpty(): ArcArray<E, [...V, {
|
|
44
|
+
name: "nonEmpty";
|
|
45
|
+
validator: (value: any[]) => {
|
|
46
|
+
readonly msg: "array is empty";
|
|
47
|
+
} | undefined;
|
|
48
|
+
}]>;
|
|
7
49
|
parse(value: util.FirstArgument<E["deserialize"]>[]): ReturnType<E["parse"]>[];
|
|
8
50
|
serialize(value: util.FirstArgument<E["serialize"]>[]): ReturnType<E["serialize"]>[];
|
|
9
51
|
deserialize(value: util.FirstArgument<E["deserialize"]>[]): ReturnType<E["deserialize"]>[];
|
|
10
52
|
deserializePath(path: string[], value: any): any;
|
|
53
|
+
validation<Name extends string, Fn extends CheckFn<any>>(name: Name, validator: Fn): ArcArray<E, GetValidator<ArcAbstract<[...V, {
|
|
54
|
+
name: Name;
|
|
55
|
+
validator: Fn;
|
|
56
|
+
}]>>>;
|
|
11
57
|
}
|
|
12
58
|
export type ArcArrayAny = ArcArray<any>;
|
|
13
|
-
export declare function array<E extends ArcElement>(element: E): ArcArray<E
|
|
59
|
+
export declare function array<E extends ArcElement>(element: E): ArcArray<E, [{
|
|
60
|
+
name: "type";
|
|
61
|
+
validator: (value: any) => false | {
|
|
62
|
+
current: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
63
|
+
expected: "array";
|
|
64
|
+
};
|
|
65
|
+
}, {
|
|
66
|
+
name: "schema";
|
|
67
|
+
validator: (values: any[]) => false | {
|
|
68
|
+
[index: number]: ReturnType<E["validate"]>;
|
|
69
|
+
};
|
|
70
|
+
}]>;
|
|
71
|
+
export {};
|
|
14
72
|
//# sourceMappingURL=array.d.ts.map
|
package/dist/elements/class.d.ts
CHANGED
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ArcElement } from "./element";
|
|
3
|
-
import type { ArcRawShape } from "./object";
|
|
4
|
-
import { ArcOptional } from "./optional";
|
|
5
|
-
export declare function ArcClass<E extends ArcRawShape>(shape: E): {
|
|
6
|
-
new (): { [key in keyof E]: ReturnType<E[key]["deserialize"]>; };
|
|
7
|
-
} & {
|
|
8
|
-
create<T extends {
|
|
9
|
-
new (): any;
|
|
10
|
-
}>(this: T, data: { [key in keyof E]: util.FirstArgument<E[key]["deserialize"]>; }): InstanceType<T>;
|
|
11
|
-
};
|
|
12
|
-
export declare class ArcInstanceOf<E> implements ArcElement {
|
|
13
|
-
private Class;
|
|
14
|
-
constructor(Class: {
|
|
15
|
-
new (): E;
|
|
16
|
-
});
|
|
17
|
-
serialize(value: unknown): unknown;
|
|
18
|
-
deserialize(value: unknown): E;
|
|
19
|
-
parse(value: unknown): unknown;
|
|
20
|
-
optional(): ArcOptional<this>;
|
|
21
|
-
}
|
|
22
|
-
export declare function instanceOf<E>(element: {
|
|
23
|
-
new (): E;
|
|
24
|
-
}): ArcInstanceOf<E>;
|
|
1
|
+
export {};
|
|
25
2
|
//# sourceMappingURL=class.d.ts.map
|